in src/mount_efs/__init__.py [0:0]
def get_aws_profile(options, use_iam):
awsprofile = options.get("awsprofile")
if not awsprofile and use_iam:
for file_path in [AWS_CREDENTIALS_FILE, AWS_CONFIG_FILE]:
aws_credentials_configs = read_config(file_path)
# check if aws access key id is found under [default] section in current file and return 'default' if so
try:
access_key = aws_credentials_configs.get("default", "aws_access_key_id")
if access_key is not None:
return "default"
except (NoSectionError, NoOptionError):
continue
return awsprofile