summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-01-15 09:18:54 -0800
committerGitHub <noreply@github.com>2018-01-15 09:18:54 -0800
commitf306c0edf623f84bb7f5acc9a107a844869da7f3 (patch)
tree2c1ef9590418d8e506c9cdc5b3e16ab5d47adfe3
parent334264b3372c8e577ba630cd90c886b11d557e78 (diff)
parent31925d596972691a127d2441d124afe6667fe755 (diff)
downloadchef-f306c0edf623f84bb7f5acc9a107a844869da7f3.tar.gz
Merge pull request #6738 from cramaechi/CHEF-5055
Fix knife status to show seconds when needed #5055
-rw-r--r--lib/chef/knife/core/status_presenter.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb
index f55f9abcbb..bb6766c6ac 100644
--- a/lib/chef/knife/core/status_presenter.rb
+++ b/lib/chef/knife/core/status_presenter.rb
@@ -101,9 +101,10 @@ class Chef
fqdn = (node[:ec2] && node[:ec2][:public_hostname]) || node[:fqdn]
name = node["name"] || node.name
- hours, minutes, = time_difference_in_hms(node["ohai_time"])
+ hours, minutes, seconds = time_difference_in_hms(node["ohai_time"])
hours_text = "#{hours} hour#{hours == 1 ? ' ' : 's'}"
minutes_text = "#{minutes} minute#{minutes == 1 ? ' ' : 's'}"
+ seconds_text = "#{seconds} second#{seconds == 1 ? ' ' : 's'}"
run_list = "#{node['run_list']}" if config[:run_list]
if hours > 24
color = :red
@@ -111,9 +112,12 @@ class Chef
elsif hours >= 1
color = :yellow
text = hours_text
- else
+ elsif minutes >= 1
color = :green
text = minutes_text
+ else
+ color = :green
+ text = seconds_text
end
line_parts = Array.new