Module: Chef::Validation::Formatter
- Defined in:
- lib/chef/validation/formatter.rb
Class Method Summary collapse
-
.format_errors(errors) ⇒ String
Formats an error hash returned by ‘Chef::Validation.run/2` into a human readable string to be output in a Chef run.
Class Method Details
.format_errors(errors) ⇒ String
Formats an error hash returned by ‘Chef::Validation.run/2` into a human readable string to be output in a Chef run.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/chef/validation/formatter.rb', line 10 def format_errors(errors) msg = [] msg << "Attribute Validation failure report:" msg << "" errors.each do |cookbook, attrs| msg << " # '#{cookbook}' failed validation for (#{attrs.length}) attribute(s)." attrs.each do |name, errs| msg << " * #{name}" errs.each do |err| msg << " - #{err}" end end end msg.join("\n") end |