From f13d48bc357a3423e4584e0f7d6627eb19521002 Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Thu, 5 Dec 2019 12:23:54 +0900 Subject: [PATCH] Show correct default value on dumping a config element Signed-off-by: Takuro Ashie --- lib/fluent/config/element.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/fluent/config/element.rb b/lib/fluent/config/element.rb index 1ad112de9f..c61eb391cb 100644 --- a/lib/fluent/config/element.rb +++ b/lib/fluent/config/element.rb @@ -182,24 +182,27 @@ def secret_param?(key) false end - def options(key) - return {} if @corresponding_proxies.empty? + def param_type(key) + return nil if @corresponding_proxies.empty? param_key = key.to_sym proxy = @corresponding_proxies.detect do |_proxy| _proxy.params.has_key?(param_key) end - return {} unless proxy + return nil unless proxy _block, opts = proxy.params[param_key] - opts - end - - def param_type(key) - options(key)[:type] + opts[:type] end def default_value(key) - options(key)[:default] + return nil if @corresponding_proxies.empty? + + param_key = key.to_sym + proxy = @corresponding_proxies.detect do |_proxy| + _proxy.params.has_key?(param_key) + end + return nil unless proxy + proxy.defaults[param_key] end def dump_value(k, v, nindent)