Parent

Class/Module Index [+]

Quicksearch

Chef::Formatters::Base

Formatters::Base

Base class that all formatters should inherit from.

Attributes

err[R]
out[R]
output[R]

Public Class Methods

cli_name(name) click to toggle source
# File lib/chef/formatters/base.rb, line 103
def self.cli_name(name)
  Chef::Formatters.register(name, self)
end
new(out, err) click to toggle source
# File lib/chef/formatters/base.rb, line 111
def initialize(out, err)
  @output = Outputter.new(out, err)
end

Public Instance Methods

attribute_file_load_failed(path, exception) click to toggle source

Delegates to file_load_failed

# File lib/chef/formatters/base.rb, line 209
def attribute_file_load_failed(path, exception)
  file_load_failed(path, exception)
end
attribute_file_loaded(path) click to toggle source

Delegates to file_loaded

# File lib/chef/formatters/base.rb, line 204
def attribute_file_loaded(path)
  file_loaded(path)
end
cookbook_resolution_failed(expanded_run_list, exception) click to toggle source
# File lib/chef/formatters/base.rb, line 146
def cookbook_resolution_failed(expanded_run_list, exception)
  description = ErrorMapper.cookbook_resolution_failed(expanded_run_list, exception)
  display_error(description)
end
cookbook_sync_failed(cookbooks, exception) click to toggle source
# File lib/chef/formatters/base.rb, line 151
def cookbook_sync_failed(cookbooks, exception)
  description = ErrorMapper.cookbook_sync_failed(cookbooks, exception)
  display_error(description)
end
definition_file_load_failed(path, exception) click to toggle source

Delegates to file_load_failed

# File lib/chef/formatters/base.rb, line 219
def definition_file_load_failed(path, exception)
  file_load_failed(path, exception)
end
definition_file_loaded(path) click to toggle source

Delegates to file_loaded

# File lib/chef/formatters/base.rb, line 214
def definition_file_loaded(path)
  file_loaded(path)
end
display_error(description) click to toggle source

Input: a Formatters::ErrorDescription object. Outputs error to SDOUT.

# File lib/chef/formatters/base.rb, line 125
def display_error(description)
  puts("")
  description.display(output)
end
file_load_failed(path, exception) click to toggle source

Generic callback for any attribute/library/lwrp/recipe file throwing an exception when loaded. Default behavior is to use CompileErrorInspector to print contextual info about the failure.

# File lib/chef/formatters/base.rb, line 173
def file_load_failed(path, exception)
  description = ErrorMapper.file_load_failed(path, exception)
  display_error(description)
end
file_loaded(path) click to toggle source

Generic callback for any attribute/library/lwrp/recipe file in a cookbook getting loaded. The per-filetype callbacks for file load are overriden so that they call this instead. This means that a subclass of Formatters::Base can implement file_loaded to do the same thing for every kind of file that Chef loads from a recipe instead of implementing all the per-filetype callbacks.

# File lib/chef/formatters/base.rb, line 167
def file_loaded(path)
end
library_file_load_failed(path, exception) click to toggle source

Delegates to file_load_failed

# File lib/chef/formatters/base.rb, line 189
def library_file_load_failed(path, exception)
  file_load_failed(path, exception)
end
library_file_loaded(path) click to toggle source

Delegates to file_loaded

# File lib/chef/formatters/base.rb, line 184
def library_file_loaded(path)
  file_loaded(path)
end
lwrp_file_load_failed(path, exception) click to toggle source

Delegates to file_load_failed

# File lib/chef/formatters/base.rb, line 199
def lwrp_file_load_failed(path, exception)
  file_load_failed(path, exception)
end
lwrp_file_loaded(path) click to toggle source

Delegates to file_loaded

# File lib/chef/formatters/base.rb, line 194
def lwrp_file_loaded(path)
  file_loaded(path)
end
node_load_failed(node_name, exception, config) click to toggle source
# File lib/chef/formatters/base.rb, line 136
def node_load_failed(node_name, exception, config)
  description = ErrorMapper.node_load_failed(node_name, exception, config)
  display_error(description)
end
puts(*args) click to toggle source
# File lib/chef/formatters/base.rb, line 115
def puts(*args)
  @output.puts(*args)
end
recipe_file_load_failed(path, exception) click to toggle source

Delegates to file_load_failed

# File lib/chef/formatters/base.rb, line 229
def recipe_file_load_failed(path, exception)
  file_load_failed(path, exception)
end
recipe_file_loaded(path) click to toggle source

Delegates to file_loaded

# File lib/chef/formatters/base.rb, line 224
def recipe_file_loaded(path)
  file_loaded(path)
end
recipe_not_found(exception) click to toggle source
# File lib/chef/formatters/base.rb, line 178
def recipe_not_found(exception)
  description = ErrorMapper.file_load_failed(nil, exception)
  display_error(description)
end
registration_failed(node_name, exception, config) click to toggle source
# File lib/chef/formatters/base.rb, line 130
def registration_failed(node_name, exception, config)
  #A Formatters::ErrorDescription object
  description = ErrorMapper.registration_failed(node_name, exception, config)
  display_error(description)
end
resource_failed(resource, action, exception) click to toggle source
# File lib/chef/formatters/base.rb, line 156
def resource_failed(resource, action, exception)
  description = ErrorMapper.resource_failed(resource, action, exception)
  display_error(description)
end
run_list_expand_failed(node, exception) click to toggle source
# File lib/chef/formatters/base.rb, line 141
def run_list_expand_failed(node, exception)
  description = ErrorMapper.run_list_expand_failed(node, exception)
  display_error(description)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.