Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) Cannot exclude multiple tags #3

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions amicleaner/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,16 @@ def map_candidates(self, candidates_amis=None, mapping_strategy=None):
mapping_strategy.get("values")
)
if mapping_strategy.get("excluded"):
excluding_ami = False
for excluded_mapping_value in mapping_strategy.get("excluded"):
if excluded_mapping_value not in mapping_value:
mapping_list = candidates_map.get(mapping_value) or []
mapping_list.append(ami)
candidates_map[mapping_value] = mapping_list
if excluded_mapping_value in mapping_value:
# Only need one tag match to exclude the ami
excluding_ami = True
break
if not excluding_ami:
mapping_list = candidates_map.get(mapping_value) or []
mapping_list.append(ami)
candidates_map[mapping_value] = mapping_list
else:
mapping_list = candidates_map.get(mapping_value) or []
mapping_list.append(ami)
Expand Down