Skip to content

Commit

Permalink
Fix parse issues when attribute is a nested hash with an array value
Browse files Browse the repository at this point in the history
  • Loading branch information
Erez Zarum committed Jan 31, 2017
1 parent ba41808 commit e09db13
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/puppet_x/icinga2/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ def self.process_hash(attrs, indent=2, level=3, prefix=' '*indent)
else "%s%s = {\n%s%s}\n" % [ prefix, attribute_types(attr), process_hash(value, indent+2), ' ' * indent ]
end
elsif value.is_a?(Array)
result += "%s%s = [ %s]\n" % [ prefix, attribute_types(attr), process_array(value) ]
result += case level
when 2 then "%s[\"%s\"] = [ %s]\n" % [ prefix, attribute_types(attr), process_array(value) ]
else "%s%s = [ %s]\n" % [ prefix, attribute_types(attr), process_array(value) ]
end
else
if level > 1
if level == 3
Expand Down

0 comments on commit e09db13

Please sign in to comment.