summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Herot <eric.github@herot.com>2015-03-24 13:26:40 -0400
committerEric Herot <eric.github@herot.com>2015-03-24 13:26:40 -0400
commit7144c8baf025c01922702b7abf106f6b7957dfdb (patch)
tree8f613c12074678d28d59294d89c33ede8108313e
parentc4ec5066313e94368d16a2c37f32973fa75c6191 (diff)
downloadchef-7144c8baf025c01922702b7abf106f6b7957dfdb.tar.gz
Check to make sure that item[:cloud][:public_hostname] is not empty before using it as the ssh target
-rw-r--r--lib/chef/knife/ssh.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 50fedd0e49..656baf5e8f 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -175,7 +175,9 @@ class Chef
if config[:attribute_from_cli]
Chef::Log.debug("Using node attribute '#{config[:attribute_from_cli]}' from the command line as the ssh target")
host = extract_nested_value(item, config[:attribute_from_cli])
- elsif item[:cloud] && item[:cloud][:public_hostname]
+ elsif item[:cloud] &&
+ item[:cloud][:public_hostname] &&
+ !item[:cloud][:public_hostname].empty?
Chef::Log.debug("Using node attribute 'cloud[:public_hostname]' automatically as the ssh target")
host = item[:cloud][:public_hostname]
else