diff --git a/app/models/host.rb b/app/models/host.rb index a9e70bb988f..33e1acbaf37 100644 --- a/app/models/host.rb +++ b/app/models/host.rb @@ -629,8 +629,8 @@ def verify_credentials_task(userid, auth_type = nil, options = {}) def verify_credentials?(auth_type = nil, options = {}) # Prevent the connection details, including the password, from being leaked into the logs # and MiqQueue by only returning true/false - auth = options.delete(:credentials) - update_authentication(auth, :save => false) if auth.present? + auth = options.delete("authentications") + update_authentication(auth.deep_symbolize_keys, :save => false) if auth.present? !!verify_credentials(auth_type, options) end diff --git a/spec/models/host_spec.rb b/spec/models/host_spec.rb index 53811ff333c..efe370e2ad1 100644 --- a/spec/models/host_spec.rb +++ b/spec/models/host_spec.rb @@ -232,10 +232,10 @@ it "passes the new credentials" do @host.update_authentication(old_creds) - @host.verify_credentials_task(FactoryBot.create(:user).userid, :default, :credentials => default_creds) + @host.verify_credentials_task(FactoryBot.create(:user).userid, :default, "authentications" => default_creds.deep_stringify_keys) expect(MiqQueue.last).to have_attributes( - :args => [:default, {:credentials => default_creds}], + :args => [:default, {"authentications" => default_creds.deep_stringify_keys}], :method_name => "verify_credentials?", :instance_id => @host.id, :class_name => @host.class.name, @@ -277,7 +277,7 @@ it "updates credentials via validate_credential options" do @host.update_authentication(old_creds) - assert_default_credentials_validated(:credentials => default_creds) + assert_default_credentials_validated("authentications" => default_creds) end end