summaryrefslogtreecommitdiff
path: root/lib/chef/formatters
diff options
context:
space:
mode:
authortylercloke <tyler@opscode.com>2013-07-08 15:37:52 -0700
committertylercloke <tyler@opscode.com>2013-07-08 15:37:52 -0700
commit5eeefe93cb9bcf8b26a0c40bf8307251073ab860 (patch)
tree4b8ac1942a92335d8f0b5dcfade936db79fb64e1 /lib/chef/formatters
parentaf181c74a1b39c123400b1027285e883e71060c3 (diff)
downloadchef-5eeefe93cb9bcf8b26a0c40bf8307251073ab860.tar.gz
Change error description sections elements to be hashes.
It is much easier for erlang to validate the json that chef-client sends up if exception_data.description.sections is of structure: [{"str1" => "value1"}, ... ] As opposed to current structure of: [["str1", "value1"], ... ] This change was achieved by updating error_description.rb. I also updated relevant test.
Diffstat (limited to 'lib/chef/formatters')
-rw-r--r--lib/chef/formatters/error_descriptor.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/chef/formatters/error_descriptor.rb b/lib/chef/formatters/error_descriptor.rb
index abf10076be..3f0756df73 100644
--- a/lib/chef/formatters/error_descriptor.rb
+++ b/lib/chef/formatters/error_descriptor.rb
@@ -31,7 +31,7 @@ class Chef
end
def section(heading, text)
- @sections << [heading, text]
+ @sections << {heading => text}
end
def display(out)
@@ -40,7 +40,9 @@ class Chef
out.puts "=" * 80
out.puts "\n"
sections.each do |section|
- display_section(section, out)
+ section.each do |heading, text|
+ display_section(heading, text, out)
+ end
end
end
@@ -53,8 +55,7 @@ class Chef
private
- def display_section(section, out)
- heading, text = section
+ def display_section(heading, text, out)
out.puts heading
out.puts "-" * heading.size
out.puts text