diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-01-25 18:44:13 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-01-25 18:44:13 -0800 |
commit | 9467b30cc1690f566f083d1710fd0436adb8b67b (patch) | |
tree | de9df5a7a957119a7dae24e3335040108fa4cc12 | |
parent | 8a805c8a71a91cb17099acdc748f619eeba45efd (diff) | |
parent | a151dea58310b51fdcb7afa78171e7ab70044170 (diff) | |
download | chef-9467b30cc1690f566f083d1710fd0436adb8b67b.tar.gz |
Merge pull request #2810 from chef/lcg/unbreak-master
fix master
-rw-r--r-- | lib/chef/application/client.rb | 4 | ||||
-rw-r--r-- | spec/data/recipes.tgz | bin | 4120 -> 293 bytes | |||
-rw-r--r-- | spec/integration/client/client_spec.rb | 11 |
3 files changed, 8 insertions, 7 deletions
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb index 024a160315..c0635e1cb5 100644 --- a/lib/chef/application/client.rb +++ b/lib/chef/application/client.rb @@ -207,7 +207,7 @@ class Chef::Application::Client < Chef::Application :boolean => true option :recipe_url, - :long => "--recipe-url", + :long => "--recipe-url=RECIPE_URL", :description => "Pull down a remote archive of recipes and unpack it to the cookbook cache. Only used in local mode." option :enable_reporting, @@ -276,8 +276,6 @@ class Chef::Application::Client < Chef::Application if !Chef::Config.local_mode && Chef::Config.has_key?(:recipe_url) Chef::Application.fatal!("chef-client recipe-url can be used only in local-mode", 1) elsif Chef::Config.local_mode && Chef::Config.has_key?(:recipe_url) - Chef::Log.debug "Cleanup path #{Chef::Config.chef_repo_path} before extract recipes into it" - FileUtils.rm_rf(Chef::Config.chef_repo_path, :secure => true) Chef::Log.debug "Creating path #{Chef::Config.chef_repo_path} to extract recipes into" FileUtils.mkdir_p(Chef::Config.chef_repo_path) tarball_path = File.join(Chef::Config.chef_repo_path, 'recipes.tgz') diff --git a/spec/data/recipes.tgz b/spec/data/recipes.tgz Binary files differindex e5d3e1669a..a6c172a001 100644 --- a/spec/data/recipes.tgz +++ b/spec/data/recipes.tgz diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index 880e9c55d8..3475a569b6 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -1,5 +1,7 @@ require 'support/shared/integration/integration_helper' require 'chef/mixin/shell_out' +require 'tiny_server' +require 'tmpdir' def recipes_filename File.join(CHEF_SPEC_DATA, 'recipes.tgz') @@ -315,17 +317,18 @@ end stop_tiny_server end + let(:tmp_dir) { Dir.mktmpdir("recipe-url") } + it "should complete with success when passed -z and --recipe-url" do file 'config/client.rb', <<EOM -cookbook_path "#{path_to('cookbooks')}" +chef_repo_path "#{tmp_dir}" EOM - - result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", :cwd => chef_dir) + result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", :cwd => tmp_dir) result.error! end it 'should fail when passed --recipe-url and not passed -z' do - result = shell_out("#{chef_client} --recipe-url=http://localhost:9000/recipes.tgz", :cwd => chef_dir) + result = shell_out("#{chef_client} --recipe-url=http://localhost:9000/recipes.tgz", :cwd => tmp_dir) expect(result.exitstatus).to eq(1) end end |