diff options
author | Claire McQuin <claire@getchef.com> | 2015-07-07 14:33:19 -0700 |
---|---|---|
committer | Claire McQuin <claire@getchef.com> | 2015-07-10 10:33:31 -0700 |
commit | 018e919fe4648de5dd3e32e0ee8547b25faf4577 (patch) | |
tree | da84c2afeab7a7ae9fb032bb809b626409464495 | |
parent | 7798f17724f011c4668bfdbeecf4e550d16d0e56 (diff) | |
download | chef-018e919fe4648de5dd3e32e0ee8547b25faf4577.tar.gz |
Use chef_environment
-rw-r--r-- | lib/chef/knife/bootstrap/client_builder.rb | 4 | ||||
-rw-r--r-- | lib/chef/knife/core/bootstrap_context.rb | 2 | ||||
-rw-r--r-- | spec/unit/knife/bootstrap/client_builder_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/knife/core/bootstrap_context_spec.rb | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/knife/bootstrap/client_builder.rb b/lib/chef/knife/bootstrap/client_builder.rb index defad7c8bc..64958c6a56 100644 --- a/lib/chef/knife/bootstrap/client_builder.rb +++ b/lib/chef/knife/bootstrap/client_builder.rb @@ -84,7 +84,7 @@ class Chef def environment # prefer environment from cli over environment from first-boot attributes knife_config[:environment] || - (first_boot_attributes[:environment] if first_boot_attributes) || + (first_boot_attributes[:chef_environment] if first_boot_attributes) || chef_config[:environment] end @@ -143,7 +143,7 @@ class Chef node.run_list(normalized_run_list) if first_boot_attributes scrubbed_first_boot_attributes = first_boot_attributes.dup - scrubbed_first_boot_attributes.delete(:environment) + scrubbed_first_boot_attributes.delete(:chef_environment) unless scrubbed_first_boot_attributes.empty? node.normal_attrs = scrubbed_first_boot_attributes end diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index ad9d4340d0..2bccc06d0e 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -47,7 +47,7 @@ class Chef # environment is set in the config file being used. However, # @config[:environment] is not polluted by @chef_config[:environment]. @config[:environment] || - (@config[:first_boot_attributes][:environment] if @config[:first_boot_attributes]) || + (@config[:first_boot_attributes][:chef_environment] if @config[:first_boot_attributes]) || @chef_config[:environment] || '_default' end diff --git a/spec/unit/knife/bootstrap/client_builder_spec.rb b/spec/unit/knife/bootstrap/client_builder_spec.rb index 68619067d7..879fac71ca 100644 --- a/spec/unit/knife/bootstrap/client_builder_spec.rb +++ b/spec/unit/knife/bootstrap/client_builder_spec.rb @@ -169,7 +169,7 @@ describe Chef::Knife::Bootstrap::ClientBuilder do end shared_examples "first-boot environment" do - let(:first_boot_attributes) {{ environment: first_boot_environment }} + let(:first_boot_attributes) {{ chef_environment: first_boot_environment }} let(:first_boot_environment) { "first_boot_environment" } @@ -193,7 +193,7 @@ describe Chef::Knife::Bootstrap::ClientBuilder do end context "when environment is not the only first-boot attribute" do - let(:first_boot_attributes) {{ environment: first_boot_environment, + let(:first_boot_attributes) {{ chef_environment: first_boot_environment, baz: :quux }} it "saves the first-boot attributes, but does not save environment" do diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb index 49a0b544bc..cd83ffa6da 100644 --- a/spec/unit/knife/core/bootstrap_context_spec.rb +++ b/spec/unit/knife/core/bootstrap_context_spec.rb @@ -105,7 +105,7 @@ EXPECTED end context "when an environment is specified" do - let(:first_boot_attributes) { {environment: "proderption"} } + let(:first_boot_attributes) { {chef_environment: "proderption"} } it "starts chef in the configured environment" do expect(bootstrap_context.start_chef).to eq('chef-client -j /etc/chef/first-boot.json -E proderption') end |