Dont retry endlessly if there is no account alias

This commit is contained in:
Stefan Reimer 2019-06-28 15:18:39 +00:00
parent 1e12bd7807
commit 71753107cc

View File

@ -84,6 +84,10 @@ def get_source(region, account_id):
iam = boto3.client('iam') iam = boto3.client('iam')
account_aliases[account_id] = iam.list_account_aliases()['AccountAliases'][0] account_aliases[account_id] = iam.list_account_aliases()['AccountAliases'][0]
# if there is no alias disable further retries
if not account_aliases[account_id]:
RESOLVE_ACCOUNT = False
source['account_alias'] = account_aliases[account_id] source['account_alias'] = account_aliases[account_id]
except(KeyError, IndexError): except(KeyError, IndexError):