Skip to content

Commit

Permalink
Fix active check when multiple results found in DDB (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksanders committed Aug 23, 2021
1 parent a01da65 commit 2b264bb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions repokid/utils/dynamo.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,10 @@ def get_role_by_arn(

if len(items) > 1:
# multiple results, so we'll grab the first match that's active
for r in items:
if r.get("Active") and isinstance(r, dict):
return r
logger.warning("found multiple results for %s in DynamoDB", arn)
for item in items:
if item.get("Active", "").lower() == "true":
return item # type: ignore

# we only have one result
if not isinstance(items[0], dict):
Expand Down

0 comments on commit 2b264bb

Please sign in to comment.