diff --git a/lib/puppet_x/icinga2/utils.rb b/lib/puppet_x/icinga2/utils.rb index 489b9b781..e8c115bf1 100644 --- a/lib/puppet_x/icinga2/utils.rb +++ b/lib/puppet_x/icinga2/utils.rb @@ -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 ])