Skip to content

Commit

Permalink
do not try to delete built in groups
Browse files Browse the repository at this point in the history
  • Loading branch information
paulineribeyre committed Dec 12, 2019
1 parent 9f49027 commit 6bc880a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fence/sync/sync_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,12 +1210,14 @@ def _update_arborist(self, session, user_yaml):

# delete from arborist the groups that have been deleted
# from the user.yaml
current_group_names = set(
arborist_groups = set(
g["name"] for g in self.arborist_client.list_groups().get("groups", [])
)
useryaml_group_names = set(g["name"] for g in groups)
for deleted_group in current_group_names.difference(useryaml_group_names):
self.arborist_client.delete_group(deleted_group)
useryaml_groups = set(g["name"] for g in groups)
for deleted_group in arborist_groups.difference(useryaml_groups):
# do not try to delete built in groups
if deleted_group not in ["anonymous", "logged-in"]:
self.arborist_client.delete_group(deleted_group)

# create/update the groups defined in the user.yaml
for group in groups:
Expand Down

0 comments on commit 6bc880a

Please sign in to comment.