diff --git a/logstash-core/lib/logstash/config/source/multi_local.rb b/logstash-core/lib/logstash/config/source/multi_local.rb index b9da78861df..2a523e85031 100644 --- a/logstash-core/lib/logstash/config/source/multi_local.rb +++ b/logstash-core/lib/logstash/config/source/multi_local.rb @@ -30,7 +30,7 @@ def initialize(settings) end def pipeline_configs - pipelines = deep_replace(retrieve_yaml_pipelines()) + pipelines = retrieve_yaml_pipelines pipelines_settings = pipelines.map do |pipeline_settings| clone = @original_settings.clone clone.merge_pipeline_settings(pipeline_settings) diff --git a/logstash-core/lib/logstash/util/substitution_variables.rb b/logstash-core/lib/logstash/util/substitution_variables.rb index 58876ff4054..c8d0ead762c 100644 --- a/logstash-core/lib/logstash/util/substitution_variables.rb +++ b/logstash-core/lib/logstash/util/substitution_variables.rb @@ -36,7 +36,6 @@ def deep_replace(value) end else if value.is_a?(Array) - value_array_index = 0 value.each_with_index do |single_value, i| value[i] = deep_replace(single_value) end diff --git a/logstash-core/spec/logstash/config/source/multi_local_spec.rb b/logstash-core/spec/logstash/config/source/multi_local_spec.rb index c59962279a0..2d7747da5ce 100644 --- a/logstash-core/spec/logstash/config/source/multi_local_spec.rb +++ b/logstash-core/spec/logstash/config/source/multi_local_spec.rb @@ -145,12 +145,24 @@ end describe "#pipeline_configs" do + + let(:config_string) { + "input { + udp { + port => 5555 # intentional comment contains \"${UDP_DEV_PORT}\" variable, shouldn't break functionalities + host => \"127.0.0.1\" + } + # another intentional comment contains \"${UDP_PROD_HOST}\" variable, shouldn't break functionalities + } + output {}" + } let(:retrieved_pipelines) do [ - { "pipeline.id" => "main", "config.string" => "input {} output {}" }, - { "pipeline.id" => "backup", "config.string" => "input {} output {}" } + { "pipeline.id" => "main", "config.string" => config_string }, + { "pipeline.id" => "backup", "config.string" => config_string } ] end + before(:each) do allow(subject).to receive(:retrieve_yaml_pipelines).and_return(retrieved_pipelines) end @@ -158,8 +170,8 @@ it "should return instances of PipelineConfig" do configs = subject.pipeline_configs expect(configs).to be_a(Array) - expect(subject.pipeline_configs.first).to be_a(::LogStash::Config::PipelineConfig) - expect(subject.pipeline_configs.last).to be_a(::LogStash::Config::PipelineConfig) + expect(configs.first).to be_a(::LogStash::Config::PipelineConfig) + expect(configs.last).to be_a(::LogStash::Config::PipelineConfig) end context "using non pipeline related settings" do