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 3f832f1e92..d43f1993b2 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 @@ -284,6 +285,21 @@ class Chef indent end + def resource_update_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}%", :green + end + end + end + # Called when a resource fails, but will retry. def resource_failed_retriable(resource, action, retry_count, exception) end |