summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2015-04-09 11:26:08 +0100
committerThom May <thom@may.lt>2015-04-09 11:26:08 +0100
commit6bfc94441e5d9b989c081c8736d7e14381e54167 (patch)
tree00bdfef7c43ca10ae120aad1e16ee2521aefcea8
parent4a109a50c781893ed44cf7d743df7f8fb43f11a2 (diff)
downloadchef-6bfc94441e5d9b989c081c8736d7e14381e54167.tar.gz
Deal with the case where we're not partial search
This is only when the long_output flag is passed, which is probably never since I only just enabled it. But we document it, so it should really work…
-rw-r--r--lib/chef/knife/core/status_presenter.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb
index a6cb7448db..9cf839d3a6 100644
--- a/lib/chef/knife/core/status_presenter.rb
+++ b/lib/chef/knife/core/status_presenter.rb
@@ -66,7 +66,7 @@ class Chef
list.each do |node|
result = {}
- result["name"] = node["name"]
+ result["name"] = node["name"] || node.name
result["chef_environment"] = node["chef_environment"]
ip = (node["ec2"] && node["ec2"]["public_ipv4"]) || node["ipaddress"]
fqdn = (node["ec2"] && node["ec2"]["public_hostname"]) || node["fqdn"]
@@ -99,6 +99,7 @@ class Chef
# special case ec2 with their split horizon whatsis.
ip = (node[:ec2] && node[:ec2][:public_ipv4]) || node[:ipaddress]
fqdn = (node[:ec2] && node[:ec2][:public_hostname]) || node[:fqdn]
+ name = node['name'] || node.name
hours, minutes, _ = time_difference_in_hms(node["ohai_time"])
hours_text = "#{hours} hour#{hours == 1 ? ' ' : 's'}"
@@ -116,7 +117,7 @@ class Chef
end
line_parts = Array.new
- line_parts << @ui.color(text, color) + ' ago' << node['name']
+ line_parts << @ui.color(text, color) + ' ago' << name
line_parts << fqdn if fqdn
line_parts << ip if ip
line_parts << run_list if run_list