lib/awskeyring/awsapi.rb in awskeyring-0.5.3 vs lib/awskeyring/awsapi.rb in awskeyring-0.6.0
- old
+ new
@@ -180,10 +180,11 @@
# @param [String] secret The aws_secret_access_key
# @param [String] account the associated account name.
# @return [String] key The aws_access_key_id
# @return [String] secret The aws_secret_access_key
# @return [String] account the associated account name.
- def self.rotate(account:, key:, secret:, key_message:) # rubocop:disable Metrics/MethodLength
+ def self.rotate(account:, key:, secret:, key_message:) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
+ ENV['AWS_DEFAULT_REGION'] = 'us-east-1' unless region
iam = Aws::IAM::Client.new(access_key_id: key, secret_access_key: secret)
if iam.list_access_keys[:access_key_metadata].length > 1
warn key_message
exit 1