Skip to content

Commit

Permalink
Rename validate_credentials to verify_credentials
Browse files Browse the repository at this point in the history
Update the name of the method to be inline with the core
verify_credentials method, ensure that the method only returns a
boolean not the raw connection, and decrypt the password field if it is
encrypted.
  • Loading branch information
agrare committed Sep 30, 2019
1 parent 8c15b56 commit fe3673a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/models/manageiq/providers/amazon/manager_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module ClassMethods
# Connections
#

# Validate Credentials
# Verify Credentials
# args:
# {
# "region" => "",
Expand All @@ -64,15 +64,16 @@ module ClassMethods
# }
# }
# }
def validate_credentials(args)
def verify_credentials(args)
region = args["region"]
default_endpoint = args.dig("endpoints", "default")

access_key, secret_access_key, proxy_uri, assume_role = default_endpoint&.values_at(
"access_key", "secret_access_key", "proxy_uri", "assume_role"
)
secret_access_key = MiqPassword.try_decrypt(secret_access_key)

raw_connect(access_key, secret_access_key, "ec2", region, proxy_uri, :assume_role => assume_role)
!!raw_connect(access_key, secret_access_key, :EC2, region, proxy_uri, :assume_role => assume_role)
end

def raw_connect(access_key_id, secret_access_key, service, region,
Expand Down

0 comments on commit fe3673a

Please sign in to comment.