Skip to content

Commit

Permalink
Fix for issue chef-boneyard#537
Browse files Browse the repository at this point in the history
"Files in Machine Resources fail to copy on windows when copied to drive root"

Performs a check that the directory does not exist before creating it.
  • Loading branch information
Geoffrey Lydall committed Aug 25, 2016
1 parent 4fd4d05 commit 6718f0c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/chef/provisioning/transport/winrm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ def read_file(path)
end

def write_file(path, content)
execute("New-Item -Type Directory -Force -Path #{escape(::File.dirname(path))}").error!
execute("
if((Test-Path(#{escape(::File.dirname(path))})) -eq 0)
{
New-Item -Type Directory -Force -Path #{escape(::File.dirname(path))}
}
").error!
chunk_size = options[:chunk_size] || 1024
# TODO if we could marshal this data directly, we wouldn't have to base64 or do this godawful slow stuff :(
index = 0
Expand Down

0 comments on commit 6718f0c

Please sign in to comment.