Avoid adding pool to group more than once

If a pool is already in the pools list for a group, don't
add it again, avoiding duplicate pool entries on keys with
permissions to access the group.

Change-Id: I8c882a33ae118cbd9d575a1da398b9184b711df3
Partial-Bug: 1424771
This commit is contained in:
James Page 2017-02-14 11:12:36 +00:00
parent bb53ae545b
commit c6c09f8d54
1 changed files with 2 additions and 1 deletions

View File

@ -208,7 +208,8 @@ def add_pool_to_group(pool, group, namespace=None):
if namespace:
group_name = "{}-{}".format(namespace, group_name)
group = get_group(group_name=group_name)
group["pools"].append(pool)
if pool not in group['pools']:
group["pools"].append(pool)
save_group(group, group_name=group_name)
for service in group['services']:
update_service_permissions(service, namespace=namespace)