diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-02-13 15:14:27 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-02-13 15:14:27 -0800 |
commit | 621bec9e651e89ccdb4b627111a4e1e62b69acda (patch) | |
tree | 8319461af373909755a882a7046e6ac8bb05b54d | |
parent | e150d7dc2c781e230d46f8a23f2c8e17e9de0042 (diff) | |
download | chef-621bec9e651e89ccdb4b627111a4e1e62b69acda.tar.gz |
fixed a bug in --bootstrap-vault-item
-rw-r--r-- | lib/chef/knife/bootstrap.rb | 7 | ||||
-rw-r--r-- | spec/unit/knife/bootstrap_spec.rb | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index 7fcdc0820f..f23c15fa70 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -212,9 +212,10 @@ class Chef :description => 'A single vault and item to update as "vault:item"', :proc => Proc.new { |i| (vault, item) = i.split(/:/) - bootstrap_vault_item ||= {} - bootstrap_vault_item[vault] ||= [] - bootstrap_vault_item[vault].push(item) + Chef::Config[:knife][:bootstrap_vault_item] ||= {} + Chef::Config[:knife][:bootstrap_vault_item][vault] ||= [] + Chef::Config[:knife][:bootstrap_vault_item][vault].push(item) + Chef::Config[:knife][:bootstrap_vault_item] } def initialize(argv=[]) diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index b7c66321c0..d7ef29e114 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -48,6 +48,13 @@ describe Chef::Knife::Bootstrap do expect(File.basename(knife.bootstrap_template)).to eq("chef-full") end + context "with --bootstrap-vault-item" do + let(:bootstrap_cli_options) { [ "--bootstrap-vault-item", "vault1:item1", "--bootstrap-vault-item", "vault1:item2", "--bootstrap-vault-item", "vault2:item1" ] } + it "sets the knife config cli option correctly" do + expect(knife.config[:bootstrap_vault_item]).to be({"vault1"=>["item1", "item2"], "vault2"=>["item1"]}) + end + end + context "with :distro and :bootstrap_template cli options" do let(:bootstrap_cli_options) { [ "--bootstrap-template", "my-template", "--distro", "other-template" ] } |