Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions os_tests/libs/resources_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time
import sys
import re
import os
try:
import boto3
from botocore.exceptions import ClientError
Expand All @@ -23,8 +24,9 @@ def __init__(self, params, vendor="redhat"):
LOG.info('Init EC2VM resource')
config = Config(retries=dict(max_attempts=10, ))
self.profile_name = params.get('profile_name')
if self.profile_name is None:
LOG.info('No profile_name provided, leave boto3 to detect authentication methods')
# Let boto3 choose where it can source the auth credentials from
if self.profile_name is None or os.environ.get('AWS_ACCESS_KEY_ID') is not None:
LOG.info('Let boto3 detect authentication methods and source credentials')
self.session = boto3.session.Session(region_name=params.get("region"))
else:
LOG.info('Load profile_name: {}'.format(self.profile_name))
Expand Down Expand Up @@ -687,8 +689,8 @@ def __init__(self, params):
LOG.info('Init EC2Volume resource')
config = Config(retries=dict(max_attempts=10, ))
self.profile_name = params.get('profile_name')
if self.profile_name is None:
LOG.info('No profile_name provided, leave boto3 to detect authentication methods')
if self.profile_name is None or os.environ.get('AWS_ACCESS_KEY_ID') is not None:
LOG.info('Let boto3 detect authentication methods and source credentials')
self.session = boto3.session.Session(region_name=params.get("region"))
else:
LOG.info('Load profile_name: {}'.format(self.profile_name))
Expand Down Expand Up @@ -877,8 +879,8 @@ def __init__(self, params):
LOG.info('Init EC2NIC resource')
config = Config(retries=dict(max_attempts=10, ))
self.profile_name = params.get('profile_name')
if self.profile_name is None:
LOG.info('No profile_name provided, leave boto3 to detect authentication methods')
if self.profile_name is None or os.environ.get('AWS_ACCESS_KEY_ID') is not None:
LOG.info('Let boto3 detect authentication methods and source credentials')
self.session = boto3.session.Session(region_name=params.get("region"))
else:
LOG.info('Load profile_name: {}'.format(self.profile_name))
Expand Down
Loading