Class: Chef::Formatters::Silent

Inherits:
Formatters::Minimal
  • Object
show all
Defined in:
lib/chef/undev/formatters/silent.rb

Instance Method Summary collapse

Instance Method Details

#converge_completeObject



53
54
# File 'lib/chef/undev/formatters/silent.rb', line 53

def converge_complete;
end

#converge_start(run_context) ⇒ Object



50
51
# File 'lib/chef/undev/formatters/silent.rb', line 50

def converge_start(run_context)
end

#cookbook_resolution_failed(expanded_run_list, exception) ⇒ Object



116
117
118
119
# File 'lib/chef/undev/formatters/silent.rb', line 116

def cookbook_resolution_failed(expanded_run_list, exception)
  description = ErrorMapper.cookbook_resolution_failed(expanded_run_list, exception)
  display_error(description)
end

#cookbook_resolution_start(expanded_run_list) ⇒ Object



26
27
28
# File 'lib/chef/undev/formatters/silent.rb', line 26

def cookbook_resolution_start(expanded_run_list)
  puts "Resolving cookbooks for run list: #{expanded_run_list.inspect}"
end

#cookbook_sync_completeObject



37
38
39
# File 'lib/chef/undev/formatters/silent.rb', line 37

def cookbook_sync_complete

end

#cookbook_sync_failed(cookbooks, exception) ⇒ Object



121
122
123
124
# File 'lib/chef/undev/formatters/silent.rb', line 121

def cookbook_sync_failed(cookbooks, exception)
  description = ErrorMapper.cookbook_sync_failed(cookbooks, exception)
  display_error(description)
end

#cookbook_sync_start(cookbook_count) ⇒ Object



30
31
32
# File 'lib/chef/undev/formatters/silent.rb', line 30

def cookbook_sync_start(cookbook_count)
  puts 'Synchronizing cookbooks'
end

#display_error(description) ⇒ Object



92
93
94
95
# File 'lib/chef/undev/formatters/silent.rb', line 92

def display_error(description)
  puts('')
  description.display(output)
end

#file_loaded(path) ⇒ Object



44
45
# File 'lib/chef/undev/formatters/silent.rb', line 44

def file_loaded(path)
end

#library_load_start(file_count) ⇒ Object



41
42
# File 'lib/chef/undev/formatters/silent.rb', line 41

def library_load_start(file_count)
end

#msg(message) ⇒ Object



62
63
# File 'lib/chef/undev/formatters/silent.rb', line 62

def msg(message)
end

#node_load_failed(node_name, exception, config) ⇒ Object



106
107
108
109
# File 'lib/chef/undev/formatters/silent.rb', line 106

def node_load_failed(node_name, exception, config)
  description = ErrorMapper.node_load_failed(node_name, exception, config)
  display_error(description)
end

#recipe_load_completeObject



47
48
# File 'lib/chef/undev/formatters/silent.rb', line 47

def recipe_load_complete;
end

#registration_failed(node_name, exception, config) ⇒ Object

Очень хотим красивые fail



101
102
103
104
# File 'lib/chef/undev/formatters/silent.rb', line 101

def registration_failed(node_name, exception, config)
  description = ErrorMapper.registration_failed(node_name, exception, config)
  display_error(description)
end

#resource_failed(resource, action, exception) ⇒ Object



126
127
128
129
# File 'lib/chef/undev/formatters/silent.rb', line 126

def resource_failed(resource, action, exception)
  description = ErrorMapper.resource_failed(resource, action, exception)
  display_error(description)
end

#resource_skipped(resource, action, conditional) ⇒ Object



56
57
# File 'lib/chef/undev/formatters/silent.rb', line 56

def resource_skipped(resource, action, conditional)
end

#resource_up_to_date(resource, action) ⇒ Object



59
60
# File 'lib/chef/undev/formatters/silent.rb', line 59

def resource_up_to_date(resource, action)
end

#resource_update_applied(resource, action, update) ⇒ Object



65
66
67
# File 'lib/chef/undev/formatters/silent.rb', line 65

def resource_update_applied(resource, action, update)
  @updates_by_resource[resource.name] << Array(update)[0]
end

#resource_updated(resource, action) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/chef/undev/formatters/silent.rb', line 69

def resource_updated(resource, action)

  if resource.kind_of?(Chef::Resource::File)
    if resource.diff
      print '=' * 80 + "\n"
      ColorDiff.print_diff resource.diff.split('\n')
      print '=' * 80 + "\n"
    end
  end

  if resource.kind_of?(Chef::Resource::Package)
    print " \n"
    if resource.version
      print("* Install package #{resource.name} version #{resource.version} \n", :green)
    else
      print("* Remove package #{resource.name} \n", :red)
    end
    print " \n"
  end

  updated_resources << resource
end

#run_completed(node) ⇒ Object



18
19
20
# File 'lib/chef/undev/formatters/silent.rb', line 18

def run_completed(node)
  puts "Chef client finished, #{@updated_resources.size} resources updated"
end

#run_failed(exception) ⇒ Object



22
23
24
# File 'lib/chef/undev/formatters/silent.rb', line 22

def run_failed(exception)
  puts "Chef client failed. #{@updated_resources.size} resources updated"
end

#run_list_expand_failed(node, exception) ⇒ Object



111
112
113
114
# File 'lib/chef/undev/formatters/silent.rb', line 111

def run_list_expand_failed(node, exception)
  description = ErrorMapper.run_list_expand_failed(node, exception)
  display_error(description)
end

#run_start(version) ⇒ Object



14
15
16
# File 'lib/chef/undev/formatters/silent.rb', line 14

def run_start(version)
  puts "Starting Chef Client, version #{version}"
end

#synchronized_cookbook(cookbook_name) ⇒ Object



34
35
# File 'lib/chef/undev/formatters/silent.rb', line 34

def synchronized_cookbook(cookbook_name)
end