mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 04:41:26 -07:00
[aws] lambda_policy fix update when principal is an account number (#44871)
Fix KeyError on update when principal is an account number
This commit is contained in:
parent
9a1191cbe5
commit
1f3e7ea061
1 changed files with 8 additions and 1 deletions
|
@ -236,7 +236,14 @@ def extract_statement(policy, sid):
|
||||||
for statement in policy['Statement']:
|
for statement in policy['Statement']:
|
||||||
if statement['Sid'] == sid:
|
if statement['Sid'] == sid:
|
||||||
policy_statement['action'] = statement['Action']
|
policy_statement['action'] = statement['Action']
|
||||||
policy_statement['principal'] = statement['Principal']['Service']
|
try:
|
||||||
|
policy_statement['principal'] = statement['Principal']['Service']
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
policy_statement['principal'] = statement['Principal']['AWS']
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
policy_statement['source_arn'] = statement['Condition']['ArnLike']['AWS:SourceArn']
|
policy_statement['source_arn'] = statement['Condition']['ArnLike']['AWS:SourceArn']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue