summaryrefslogtreecommitdiff
path: root/lib/chef/formatters
diff options
context:
space:
mode:
authorJoel Handwell <joelhandwell@gmail.com>2015-08-31 08:31:55 -0400
committerJoel Handwell <joelhandwell@gmail.com>2015-09-02 07:55:25 -0400
commit850bded619ac14e62bed15b85cc34d6ef3b99202 (patch)
tree10d83b6d47ef92439d00ce42733ee6fce9a6b71a /lib/chef/formatters
parent5f6589f3c05c965d3c555613bf21c635978a36be (diff)
downloadchef-850bded619ac14e62bed15b85cc34d6ef3b99202.tar.gz
Keep elapsed_time and add pretty_elapsed_time
Diffstat (limited to 'lib/chef/formatters')
-rw-r--r--lib/chef/formatters/doc.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb
index 93039d6171..2b0161667b 100644
--- a/lib/chef/formatters/doc.rb
+++ b/lib/chef/formatters/doc.rb
@@ -26,7 +26,11 @@ class Chef
end
def elapsed_time
- time = end_time - start_time
+ end_time - start_time
+ end
+
+ def pretty_elapsed_time
+ time = elapsed_time
if time < 60 then
message = Time.at(time).utc.strftime("%S seconds")
elsif time < 3600 then
@@ -74,7 +78,7 @@ class Chef
if Chef::Config[:why_run]
puts_line "Chef Client finished, #{@updated_resources}/#{total_resources} resources would have been updated"
else
- puts_line "Chef Client finished, #{@updated_resources}/#{total_resources} resources updated in #{elapsed_time}"
+ puts_line "Chef Client finished, #{@updated_resources}/#{total_resources} resources updated in #{pretty_elapsed_time}"
if total_audits > 0
puts_line " #{successful_audits}/#{total_audits} controls succeeded"
end
@@ -86,7 +90,7 @@ class Chef
if Chef::Config[:why_run]
puts_line "Chef Client failed. #{@updated_resources} resources would have been updated"
else
- puts_line "Chef Client failed. #{@updated_resources} resources updated in #{elapsed_time}"
+ puts_line "Chef Client failed. #{@updated_resources} resources updated in #{pretty_elapsed_time}"
if total_audits > 0
puts_line " #{successful_audits} controls succeeded"
end