summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2018-05-03 17:31:55 -0600
committertyler-ball <tyleraball@gmail.com>2018-05-03 17:31:58 -0600
commit06a00403026b06548671adb6239ab44cab4981c2 (patch)
treeea888c7cd24932838541a5ff9701010c9dca6f16
parent92e03cdd565adb06f28bbf1a978a2be1d74e1830 (diff)
downloadchef-06a00403026b06548671adb6239ab44cab4981c2.tar.gz
Trying to use --recipe-url on Windows with local file fails
I'm guessing open-uri doesn't handle local file paths well with `open`? Either way this fixes the issue. Signed-off-by: tyler-ball <tyleraball@gmail.com>
-rw-r--r--lib/chef/application/client.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index 28de71fa71..b5ce2decb3 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -534,9 +534,13 @@ class Chef::Application::Client < Chef::Application
def fetch_recipe_tarball(url, path)
Chef::Log.trace("Download recipes tarball from #{url} to #{path}")
- File.open(path, "wb") do |f|
- open(url) do |r|
- f.write(r.read)
+ if File.exist?(url)
+ FileUtils.cp(url, path)
+ else
+ File.open(path, "wb") do |f|
+ open(url) do |r|
+ f.write(r.read)
+ end
end
end
end