summaryrefslogtreecommitdiff
path: root/lib/chef/knife/ssh.rb
diff options
context:
space:
mode:
authorBryan McLellan <btm@getchef.com>2014-06-20 12:46:49 -0700
committerBryan McLellan <btm@getchef.com>2014-06-20 12:46:49 -0700
commit97cd18bc0c07e80b542796d0a067873034f99c80 (patch)
tree72e9edc8f4f34a2e3fb719ab90d13bc5a85851b9 /lib/chef/knife/ssh.rb
parente0a54977b3b5bd73989d5e21bc7bc0b88944ea52 (diff)
downloadchef-97cd18bc0c07e80b542796d0a067873034f99c80.tar.gz
CHEF-5158: Make the former override_attribute's purpose a bit more clear
Diffstat (limited to 'lib/chef/knife/ssh.rb')
-rw-r--r--lib/chef/knife/ssh.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 38ff84ebb5..b039830253 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -170,12 +170,13 @@ class Chef
# if a command line attribute was not passed, and we have a
# cloud public_hostname, use that. see #configure_attribute
# for the source of config[:attribute] and
- # config[:override_attribute]
- if config[:override_attribute]
- host = extract_nested_value(item, config[:override_attribute])
+ # config[:attribute_from_cli]
+ if config[:attribute_from_cli]
+ host = extract_nested_value(item, config[:attribute_from_cli])
elsif item[:cloud] && item[:cloud][:public_hostname]
host = item[:cloud][:public_hostname]
else
+ # ssh attribute from a configuration file or the default will land here
host = extract_nested_value(item, config[:attribute])
end
# next if we couldn't find the specified attribute in the
@@ -413,8 +414,8 @@ class Chef
# Thus we can differentiate between a config file value and a command line override at this point by checking config[:attribute]
# 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] = (config[:override_attribute] || "fqdn").strip
+ config[:attribute_from_cli] = config[:attribute]
+ config[:attribute] = (config[:attribute_from_cli] || Chef::Config[:knife][:ssh_attribute] || "fqdn").strip
end
def cssh