Skip to content

Commit

Permalink
support quoted plugin option key (elastic#11688)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinsurprenant authored Mar 16, 2020
1 parent 86a3ab9 commit 9126fdb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion logstash-core/lib/logstash/compiler/lscl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def expr

class Attribute < Node
def expr
[name.text_value, value.expr]
[name.is_a?(AST::String) ? name.text_value[1...-1] : name.text_value, value.expr]
end
end

Expand Down
15 changes: 15 additions & 0 deletions logstash-core/spec/logstash/compiler/compiler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,21 @@ def rand_meta
end
end

describe "a plugin with quoted parameter keys" do
let(:plugin_source) { "generator { notquoted => 1 'singlequoted' => 2 \"doublequoted\" => 3}" }
let(:expected_plugin_args) do
{
"notquoted" => 1,
"singlequoted" => 2,
"doublequoted" => 3,
}
end

it "should contain the plugin" do
expect(c_plugin).to ir_eql(j.iPlugin(rand_meta, INPUT, "generator", expected_plugin_args))
end
end

describe "a plugin with multiple array parameter types" do
let(:plugin_source) { "generator { aarg => [1] aarg => [2] aarg => [3]}" }
let(:expected_plugin_args) do
Expand Down

0 comments on commit 9126fdb

Please sign in to comment.