diff options
author | tyler-ball <tyleraball@gmail.com> | 2018-05-03 17:31:55 -0600 |
---|---|---|
committer | tyler-ball <tyleraball@gmail.com> | 2018-05-03 17:31:58 -0600 |
commit | 06a00403026b06548671adb6239ab44cab4981c2 (patch) | |
tree | ea888c7cd24932838541a5ff9701010c9dca6f16 | |
parent | 92e03cdd565adb06f28bbf1a978a2be1d74e1830 (diff) | |
download | chef-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.rb | 10 |
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 |