Skip to content

Commit

Permalink
Fixed handling of custom roleConfigGroups.
Browse files Browse the repository at this point in the history
When a roleConfigGroup was referenced in multiple templates it would be
duplicated in the final cluster template. This fix removes the duplication.
  • Loading branch information
asdaraujo committed Mar 2, 2022
1 parent 58b3001 commit 0d5d1f9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions plugins/filter/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,17 @@ def extract_role_and_group(self, role_spec):
return (role, template_group)

def extract_custom_roles(self, host_templates, service):
custom_roles = []
custom_roles = set([])
for role_mapping in host_templates.values():
if service in role_mapping:
for custom_role in filter(lambda x: '/' in x, role_mapping[service]):
custom_roles.append(custom_role)
return custom_roles
custom_roles.add(custom_role)
return list(custom_roles)

def extract_custom_role_groups(self, host_templates):
custom_role_groups = []
custom_role_groups = set([])
for role_mapping in host_templates.values():
for (service, roles) in role_mapping.items():
for custom_role in filter(lambda x: '/' in x, roles):
custom_role_groups.append("-".join([service.lower()] + custom_role.split("/")))
return custom_role_groups
custom_role_groups.add("-".join([service.lower()] + custom_role.split("/")))
return list(custom_role_groups)

0 comments on commit 0d5d1f9

Please sign in to comment.