Skip to content

Commit

Permalink
fix #247 hash key with empty hash as value is parsed wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
lbetz committed Mar 3, 2017
1 parent 0f54f06 commit 68bbd35
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/puppet_x/icinga2/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ def self.process_hash(attrs, indent=2, level=3, prefix=' '*indent)
attrs.each do |attr, value|
if value.is_a?(Hash)
if value.empty?
result = "%s%s = {}\n" % [ prefix, attribute_types(attr) ]
result = case level
when 1 then "%s%s = {}\n" % [ prefix, attribute_types(attr) ]
when 2 then "%s[\"%s\"] = {}\n" % [ prefix, attr ]
else "%s%s = {}\n" % [ prefix, attribute_types(attr) ]
end
else
result += case level
when 1 then process_hash(value, indent, 2, "%s%s" % [ prefix, attr ])
Expand Down

0 comments on commit 68bbd35

Please sign in to comment.