summaryrefslogtreecommitdiff
path: root/lib/chef/formatters
diff options
context:
space:
mode:
authorBrandon Raabe <brandocorp@gmail.com>2015-03-20 23:44:12 -0700
committerBrandon Raabe <brandocorp@gmail.com>2015-03-20 23:44:12 -0700
commit57a6de57d60a75749a8345af9807d4abf24b6924 (patch)
treed8bfd1f0d9f67ff82e90037c9eec0a9df4d3cfb3 /lib/chef/formatters
parent19d31707dba909bcb8d24dac6293e9341ccb0b16 (diff)
downloadchef-57a6de57d60a75749a8345af9807d4abf24b6924.tar.gz
new doc formatter event, remove progress bar
Diffstat (limited to 'lib/chef/formatters')
-rw-r--r--lib/chef/formatters/doc.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb
index 489888db8f..7605b93301 100644
--- a/lib/chef/formatters/doc.rb
+++ b/lib/chef/formatters/doc.rb
@@ -22,6 +22,7 @@ class Chef
@failed_audits = 0
@start_time = Time.now
@end_time = @start_time
+ @progress = {}
end
def elapsed_time
@@ -216,6 +217,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