Skip to content

Commit 315992d

Browse files
move options validation in build_client
1 parent 5d1145a commit 315992d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/logstash/outputs/elasticsearch.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,14 @@ def config_init(params)
259259
end
260260

261261
def build_client
262+
# the following 3 options validation & setup methods are called inside build_client
263+
# because they must be executed prior to building the client and logstash
264+
# monitoring and management rely on directly calling build_client
265+
# see https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/934#pullrequestreview-396203307
266+
validate_authentication
267+
fill_hosts_from_cloud_id
268+
setup_hosts
269+
262270
params["metric"] = metric
263271
if @proxy.eql?('')
264272
@logger.warn "Supplied proxy setting (proxy => '') has no effect"

lib/logstash/outputs/elasticsearch/common.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ def register
2020
@stopping = Concurrent::AtomicBoolean.new(false)
2121
# To support BWC, we check if DLQ exists in core (< 5.4). If it doesn't, we use nil to resort to previous behavior.
2222
@dlq_writer = dlq_enabled? ? execution_context.dlq_writer : nil
23-
validate_authentication
24-
fill_hosts_from_cloud_id
25-
setup_hosts # properly sets @hosts
2623
build_client
2724
setup_after_successful_connection
2825
check_action_validity

0 commit comments

Comments
 (0)