diff options
Diffstat (limited to 'lib/chef/formatters/doc.rb')
-rw-r--r-- | lib/chef/formatters/doc.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb index 5462241049..31732066a8 100644 --- a/lib/chef/formatters/doc.rb +++ b/lib/chef/formatters/doc.rb @@ -23,6 +23,7 @@ class Chef @start_time = Time.now @end_time = @start_time @skipped_resources = 0 + @progress = {} end def elapsed_time @@ -258,6 +259,21 @@ class Chef indent end + def resource_action_progress(resource, current, total, interval) + @progress[resource] ||= 0 + + percent_complete = (current.to_f / total.to_f * 100).to_i + + if percent_complete > @progress[resource] + + @progress[resource] = percent_complete + + if percent_complete % interval == 0 + start_line " - Progress: #{percent_complete}/100 %", :green + end + end + end + # Called when a resource fails, but will retry. def resource_failed_retriable(resource, action, retry_count, exception) end |