Omit empty section when dump configuration

Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
Kenji Okimoto 2018-06-21 15:29:47 +09:00
parent 3a2835429a
commit e980c3a7a3
No known key found for this signature in database
GPG Key ID: F9E3E329A5C5E4A1
2 changed files with 4 additions and 2 deletions

View File

@ -72,7 +72,7 @@ class Fluentd
end
elements = section_params.map do |index, _section_params|
section_class.new(_section_params).to_config
end
end.compact
end
attrs = params.to_h.reject do |key, value|
skip?(key.to_sym, value)

View File

@ -11,7 +11,9 @@ class Fluentd
end
argument = _attributes.delete(self._argument_name.to_s) || ""
attrs, elements = parse_attributes(_attributes)
config_element(section_name, argument, attrs, elements)
if attrs.present? || elements.present?
config_element(section_name, argument, attrs, elements)
end
end
def parse_attributes(attributes)