mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix broken LimitExceeded check in iam_managed_policy (#30537)
When policy versions exceed 5, we hit LimitExceeded. However, the exception checking should use `e.response['Error']['Code']`
This commit is contained in:
parent
d74c871559
commit
18582295e3
1 changed files with 1 additions and 1 deletions
|
@ -188,7 +188,7 @@ def get_or_create_policy_version(module, iam, policy, policy_document):
|
|||
version = iam.create_policy_version(PolicyArn=policy['Arn'], PolicyDocument=policy_document)['PolicyVersion']
|
||||
return version, True
|
||||
except botocore.exceptions.ClientError as e:
|
||||
if e['Error']['Code'] == 'LimitExceeded':
|
||||
if e.response['Error']['Code'] == 'LimitExceeded':
|
||||
delete_oldest_non_default_version(module, iam, policy)
|
||||
try:
|
||||
version = iam.create_policy_version(PolicyArn=policy['Arn'], PolicyDocument=policy_document)['PolicyVersion']
|
||||
|
|
Loading…
Reference in a new issue