summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Hu <huh@vmware.com>2014-04-08 17:41:42 +0800
committerBryan McLellan <btm@getchef.com>2014-06-20 12:25:09 -0700
commite0a54977b3b5bd73989d5e21bc7bc0b88944ea52 (patch)
treef862d1ce8e5f6c5d9fe718ad7a280777096f2681
parentf6730f41b46fb9f3ffa5c6fea71d90b5964e779b (diff)
downloadchef-e0a54977b3b5bd73989d5e21bc7bc0b88944ea52.tar.gz
[CHEF-5158] knife[:attribute] in knife.rb should not override --attribute in the command line
-rw-r--r--lib/chef/knife/ssh.rb4
-rw-r--r--spec/unit/knife/ssh_spec.rb1
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 4edc63d8d3..38ff84ebb5 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -414,9 +414,7 @@ class Chef
# We can tell here if fqdn was passed from the command line, rather than being the default, by checking config[:attribute]
# However, after here, we cannot tell these things, so we must preserve config[:attribute]
config[:override_attribute] = config[:attribute] || Chef::Config[:knife][:ssh_attribute]
- config[:attribute] = (Chef::Config[:knife][:ssh_attribute] ||
- config[:attribute] ||
- "fqdn").strip
+ config[:attribute] = (config[:override_attribute] || "fqdn").strip
end
def cssh
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 9247db3c90..3404ce597c 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -173,6 +173,7 @@ describe Chef::Knife::Ssh do
Chef::Config[:knife][:ssh_attribute] = "config_file"
@knife.config[:attribute] = "command_line"
@knife.configure_attribute
+ @knife.config[:attribute].should == "command_line"
@knife.config[:override_attribute].should == "command_line"
end
end