diff options
-rw-r--r-- | chef/lib/chef/client.rb | 2 | ||||
-rw-r--r-- | chef/spec/unit/client_spec.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/chef/lib/chef/client.rb b/chef/lib/chef/client.rb index e1b5246d1e..8bf41761f3 100644 --- a/chef/lib/chef/client.rb +++ b/chef/lib/chef/client.rb @@ -241,7 +241,7 @@ class Chef def build_node # Allow user to override the environment of a node by specifying # a config parameter. - if Chef::Config[:environment] && !Chef::Config[:environment].chop.empty? + if Chef::Config[:environment] && !Chef::Config[:environment].chomp.empty? @node.chef_environment(Chef::Config[:environment]) end diff --git a/chef/spec/unit/client_spec.rb b/chef/spec/unit/client_spec.rb index 9497865c73..89caa46de9 100644 --- a/chef/spec/unit/client_spec.rb +++ b/chef/spec/unit/client_spec.rb @@ -230,6 +230,12 @@ shared_examples_for Chef::Client do @node[:recipes].length.should == 1 @node[:recipes].should include("cookbook1") end + + it "should set the environment from the specified configuration value" do + Chef::Config[:environment] = "A" + @client.build_node + @node.chef_environment.should == "A" + end end describe "when a run list override is provided" do |