From 2b264bb847b0ab431e792753e26a2c43612d6296 Mon Sep 17 00:00:00 2001 From: Patrick Sanders Date: Mon, 23 Aug 2021 16:05:45 -0700 Subject: [PATCH] Fix active check when multiple results found in DDB (#291) --- repokid/utils/dynamo.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/repokid/utils/dynamo.py b/repokid/utils/dynamo.py index ff0e9816..e265c758 100644 --- a/repokid/utils/dynamo.py +++ b/repokid/utils/dynamo.py @@ -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):