Class: Chef::Formatters::Nice
- Inherits:
-
Formatters::Base
- Object
- Formatters::Base
- Chef::Formatters::Nice
- Defined in:
- lib/nice-chef-formatter.rb
Instance Method Summary collapse
- #converge_complete ⇒ Object
- #converge_start(run_context) ⇒ Object
-
#cookbook_resolution_start(expanded_run_list) ⇒ Object
Called before the cookbook collection is fetched from the server.
-
#cookbook_sync_complete ⇒ Object
Called after all cookbooks have been sync’d.
- #cookbook_sync_start(cookbook_count) ⇒ Object
-
#initialize(out, err) ⇒ Nice
constructor
Override parent class.
-
#library_load_start(file_count) ⇒ Object
Called when cookbook loading starts.
-
#ohai_completed(node) ⇒ Object
Called right after ohai runs.
- #resource_action_start(resource, action, notification_type = nil, notifier = nil) ⇒ Object
-
#resource_skipped(resource, action, conditional) ⇒ Object
Called when a resource action has been skipped b/c of a conditional.
-
#resource_up_to_date(resource, action) ⇒ Object
Called when a resource has no converge actions, e.g., it was already correct.
-
#resource_updated(resource, action) ⇒ Object
Called after a resource has been completely converged.
-
#run_start(version) ⇒ Object
Called at the very start of a Chef Run.
-
#synchronized_cookbook(cookbook_name) ⇒ Object
Called when cookbook
cookbook_name
has been sync’d.
Constructor Details
#initialize(out, err) ⇒ Nice
Override parent class
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/nice-chef-formatter.rb', line 10 def initialize(out, err) super livedrive_title = " ===================================================================== ===================================================================== dP\"\"b8 88 88 888888 888888 88\"\"Yb 88 88 88b 88 dP `I 88 88 88__ 88__ 88__dP 88 88 88Yb88 Yb 888888 88\"\" 88\"\" 88\"Yb Y8 8P 88 Y88 YboodP 88 88 888888 88 88 Yb `YbodP' 88 Y8 ===================================================================== ===================================================================== " puts livedrive_title end |
Instance Method Details
#converge_complete ⇒ Object
58 59 60 61 |
# File 'lib/nice-chef-formatter.rb', line 58 def converge_complete total_exec_time = Time.now.to_f - @initial_time puts "System converged in #{total_exec_time.round(2)}" end |
#converge_start(run_context) ⇒ Object
54 55 56 |
# File 'lib/nice-chef-formatter.rb', line 54 def converge_start(run_context) puts "Converge #{run_context.resource_collection.all_resources.size} resources" end |
#cookbook_resolution_start(expanded_run_list) ⇒ Object
Called before the cookbook collection is fetched from the server.
34 35 36 |
# File 'lib/nice-chef-formatter.rb', line 34 def cookbook_resolution_start() puts "Very run list: #{.inspect}" end |
#cookbook_sync_complete ⇒ Object
Called after all cookbooks have been sync’d.
49 50 51 52 |
# File 'lib/nice-chef-formatter.rb', line 49 def cookbook_sync_complete sync_exec_time = Time.now.to_f - @sync_start_time puts "Finish cookbook synchronization (#{sync_exec_time.round(3)} secs)" end |
#cookbook_sync_start(cookbook_count) ⇒ Object
38 39 40 41 |
# File 'lib/nice-chef-formatter.rb', line 38 def cookbook_sync_start(cookbook_count) @sync_start_time = Time.now.to_f puts "Cookbook synchronization" end |
#library_load_start(file_count) ⇒ Object
Called when cookbook loading starts.
64 65 66 |
# File 'lib/nice-chef-formatter.rb', line 64 def library_load_start(file_count) puts "Compilation" end |
#ohai_completed(node) ⇒ Object
Called right after ohai runs.
69 70 71 |
# File 'lib/nice-chef-formatter.rb', line 69 def ohai_completed(node) puts "Ohai comleted" end |
#resource_action_start(resource, action, notification_type = nil, notifier = nil) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/nice-chef-formatter.rb', line 73 def resource_action_start(resource, action, notification_type=nil, notifier=nil) if resource.cookbook_name && resource.recipe_name resource_recipe = "#{resource.cookbook_name}::#{resource.recipe_name}" else resource_recipe = "#{resource.cookbook_name}" end if resource_recipe != @current_recipe if @recipe_start_time recipe_exec_time = Time.now.to_f - @recipe_start_time puts "(#{recipe_exec_time.round(3)} secs)" end puts "Recipe: #{resource_recipe}" @current_recipe = resource_recipe @recipe_start_time = Time.now.to_f end @resource_start_time = Time.now.to_f end |
#resource_skipped(resource, action, conditional) ⇒ Object
Called when a resource action has been skipped b/c of a conditional
93 94 95 96 97 |
# File 'lib/nice-chef-formatter.rb', line 93 def resource_skipped(resource, action, conditional) # Output should be blue (Skipped) resource_exec_time = Time.now.to_f - @resource_start_time puts(" * #{resource} action #{action} (#{resource_exec_time.round(3)} secs)", :blue) end |
#resource_up_to_date(resource, action) ⇒ Object
Called when a resource has no converge actions, e.g., it was already correct.
100 101 102 103 104 |
# File 'lib/nice-chef-formatter.rb', line 100 def resource_up_to_date(resource, action) # Output should be green resource_exec_time = Time.now.to_f - @resource_start_time puts(" * #{resource} action #{action} (#{resource_exec_time.round(3)} secs)", :green) end |
#resource_updated(resource, action) ⇒ Object
Called after a resource has been completely converged.
107 108 109 110 111 |
# File 'lib/nice-chef-formatter.rb', line 107 def resource_updated(resource, action) # Output should be yellow (changes are applied) resource_exec_time = Time.now.to_f - @resource_start_time puts(" * #{resource} action #{action} (#{resource_exec_time.round(3)} secs)", :yellow) end |
#run_start(version) ⇒ Object
Called at the very start of a Chef Run
28 29 30 31 |
# File 'lib/nice-chef-formatter.rb', line 28 def run_start(version) puts "Starting Chef Client, version #{version}" @initial_time = Time.now.to_f end |
#synchronized_cookbook(cookbook_name) ⇒ Object
Called when cookbook cookbook_name
has been sync’d
44 45 46 |
# File 'lib/nice-chef-formatter.rb', line 44 def synchronized_cookbook(cookbook_name) puts " - #{cookbook_name}" end |