Skip to content

Commit

Permalink
Fix role matching if multiple roles exist for the requested variant
Browse files Browse the repository at this point in the history
  • Loading branch information
interatom committed May 2, 2019
1 parent 6cebfbf commit 45c9341
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions action_plugins/conga_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ def _match_conga_role(self, roles, ansible_role, ansible_variant):
# filter by role name
matching_roles = filter(lambda role: role.get("role", "") == ansible_role, roles)

# filter by variant name
# filter matching roles by variant name
if ansible_variant:
matching_roles = filter(lambda role: ansible_variant in role.get("variants", ""), roles)
matching_roles = filter(lambda role: ansible_variant in role.get("variants", ""), matching_roles)

# warn if the matched role is not unique
if len(matching_roles) > 1:
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ roles:
tenants:
- tenant: tenant1
- role: cms
- role: monitoring
variants: [publish]
- role: dispatcher
variants: [author, ssl]
- role: dispatcher
Expand Down

0 comments on commit 45c9341

Please sign in to comment.