Skip to content

Commit

Permalink
dsl: Need '@' prefix for reserved system parameters. fix #2028
Browse files Browse the repository at this point in the history
Signed-off-by: Masahiro Nakagawa <[email protected]>
  • Loading branch information
repeatedly committed Jun 25, 2018
1 parent b593e6f commit 79cb793
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/fluent/config/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
module Fluent
module Config
module DSL
SYSTEM_PARAM = [:type, :id, :log_level] # Add '@' prefix to avoid deprecation message

module Parser
def self.read(path)
path = File.expand_path(path)
Expand Down Expand Up @@ -95,11 +97,12 @@ def method_missing(name, *args, &block)
proxy.element.instance_exec(&block)
@elements.push(proxy.to_config_element)
else
@attrs[name.to_s] = if value.is_a?(Array) || value.is_a?(Hash)
JSON.dump(value)
else
value.to_s
end
param_name = SYSTEM_PARAM.include?(name) ? "@#{name}" : name.to_s
@attrs[param_name] = if value.is_a?(Array) || value.is_a?(Hash)
JSON.dump(value)
else
value.to_s
end
end

self
Expand Down

0 comments on commit 79cb793

Please sign in to comment.