Skip to content

Commit

Permalink
Check that tags are not null before iterating over them (duo-labs#780)
Browse files Browse the repository at this point in the history
* Check that tags are not null before iterating over them
  • Loading branch information
mulder-sean authored Nov 16, 2020
1 parent f350b72 commit 5c8a5a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ auditor/node_modules
auditor/.cdk.staging
auditor/cdk.out
auditor/.env
auditor/resources/cloudmapper
auditor/resources/cloudmapper
13 changes: 7 additions & 6 deletions commands/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,13 @@ def build_data_structure(account_data, config, outputfilter):
# For a tag set, see if all conditions match, ex. [["Team","Dev"],["Name","Bastion"]]
for pair in conditions:
# Given ["Team","Dev"], see if it matches one of the tags in the node
for tag in node.tags:
if (
tag.get("Key", "") == pair[0]
and tag.get("Value", "") == pair[1]
):
condition_matches += 1
if node.tags:
for tag in node.tags:
if (
tag.get("Key", "") == pair[0]
and tag.get("Value", "") == pair[1]
):
condition_matches += 1
# We have a match if all of the conditions matched
if condition_matches == len(conditions):
has_match = True
Expand Down

0 comments on commit 5c8a5a3

Please sign in to comment.