mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
correct ES_client to only split strings + add csv_string(array) method (#7722)
an x-pack-logstash PR will be reliant on the csv_string method.
This commit is contained in:
parent
e87f810c76
commit
dbcce19888
2 changed files with 9 additions and 1 deletions
|
@ -108,7 +108,11 @@ module LogStash class ElasticsearchClient
|
|||
end
|
||||
|
||||
def unpack_hosts
|
||||
@settings.fetch("var.elasticsearch.hosts", "localhost:9200").split(',').map(&:strip)
|
||||
setting = @settings.fetch("var.elasticsearch.hosts", "localhost:9200")
|
||||
if setting.is_a?(String)
|
||||
return setting.split(',').map(&:strip)
|
||||
end
|
||||
setting
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -33,6 +33,10 @@ module LogStash module Modules class LogStashConfig
|
|||
"[#{array.collect { |i| "'#{i}'" }.join(", ")}]"
|
||||
end
|
||||
|
||||
def csv_string(array)
|
||||
"'#{array.join(',')}'"
|
||||
end
|
||||
|
||||
def get_setting(setting_class)
|
||||
raw_value = @settings[setting_class.name]
|
||||
# If we dont check for NIL, the Settings class will try to coerce the value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue