Skip to content

Commit 526c880

Browse files
use fill_user_password_from_cloud_auth
1 parent fb33a38 commit 526c880

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/logstash/inputs/elasticsearch.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def register
182182
end
183183

184184
validate_authentication
185+
fill_user_password_from_cloud_auth
185186
fill_hosts_from_cloud_id
186187

187188

@@ -356,11 +357,6 @@ def validate_authentication
356357
if @api_key && @api_key.value && @ssl != true
357358
raise(LogStash::ConfigurationError, "Using api_key authentication requires SSL/TLS secured communication using the `ssl => true` option")
358359
end
359-
360-
if @cloud_auth
361-
@user, @password = parse_user_password_from_cloud_auth(@cloud_auth)
362-
params['user'], params['password'] = @user, @password
363-
end
364360
end
365361

366362
def setup_ssl
@@ -393,6 +389,12 @@ def setup_api_key(api_key)
393389
{ Authorization: "ApiKey #{token}" }
394390
end
395391

392+
def fill_user_password_from_cloud_auth
393+
return unless @cloud_auth
394+
395+
@user, @password = parse_user_password_from_cloud_auth(@cloud_auth)
396+
params['user'], params['password'] = @user, @password
397+
end
396398

397399
def fill_hosts_from_cloud_id
398400
return unless @cloud_id

0 commit comments

Comments
 (0)