diff options
author | Tyler Ball <tball@chef.io> | 2018-08-07 15:36:37 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-07 15:36:37 -0600 |
commit | 91be3411b462344ea2fba86c03bc188d64634567 (patch) | |
tree | 123545cefd73f2a4ffdea5560b95d5a6c8994bc0 | |
parent | 6d79935c4a69f8ba1ba52844b65201773e38fba6 (diff) | |
parent | 4ba68cbe05f201d1e2dcabfedbb1cc17bc032c3f (diff) | |
download | chef-91be3411b462344ea2fba86c03bc188d64634567.tar.gz |
Merge pull request #7522 from chef/cp-22/chef-13
[SHACK-290] Unpacking tarball paths suffer from URI error
-rw-r--r-- | lib/chef/application/client.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb index 7713350352..c94af6f0d2 100644 --- a/lib/chef/application/client.rb +++ b/lib/chef/application/client.rb @@ -529,14 +529,14 @@ class Chef::Application::Client < Chef::Application def fetch_recipe_tarball(url, path) Chef::Log.debug("Download recipes tarball from #{url} to #{path}") - if url =~ URI.regexp + if File.exist?(url) + FileUtils.cp(url, path) + elsif url =~ URI.regexp File.open(path, "wb") do |f| open(url) do |r| f.write(r.read) end end - elsif File.exist?(url) - FileUtils.cp(url, path) else Chef::Application.fatal! "You specified --recipe-url but the value is neither a valid URL nor a path to a file that exists on disk." + "Please confirm the location of the tarball and try again." |