Skip to content

Commit

Permalink
Merge 3ab29f7 into 2e6abe0
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgarvin1 committed Mar 3, 2021
2 parents 2e6abe0 + 3ab29f7 commit f51f61a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ repos:
- id: no-commit-to-branch
args: [--branch, develop, --branch, master, --pattern, release/.*]
- repo: https://github.com/psf/black
rev: 20.8b1
rev: stable
hooks:
- id: black
17 changes: 12 additions & 5 deletions fence/sync/sync_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,12 +1498,20 @@ def _update_arborist(self, session, user_yaml):
roles = user_yaml.authz.get("roles", [])
for role in roles:
try:
response = self.arborist_client.create_role(role)
response = self.arborist_client.update_role(role["id"], role)
if response:
self._created_roles.add(role["id"])
except ArboristError as e:
self.logger.error(e)
# keep going; maybe just some conflicts from things existing already
self.logger.info(
"couldn't update role '{}', creating instead".format(str(e))
)
try:
response = self.arborist_client.create_role(role)
if response:
self._created_roles.add(role["id"])
except ArboristError as e:
self.logger.error(e)
# keep going; maybe just some conflicts from things existing already

# update policies
policies = user_yaml.authz.get("policies", [])
Expand Down Expand Up @@ -1607,7 +1615,6 @@ def _update_authz_in_arborist(self, session, user_projects, user_yaml=None):
user_yaml.user_abac = {
key.lower(): value for key, value in user_yaml.user_abac.items()
}

# update the project info with `projects` specified in user.yaml
self.sync_two_phsids_dict(user_yaml.user_abac, user_projects)

Expand All @@ -1622,7 +1629,7 @@ def _update_authz_in_arborist(self, session, user_projects, user_yaml=None):
arborist_user_projects = {
user["name"].lower(): {} for user in arborist_users
}
except (ArboristError, KeyError) as error:
except (ArboristError, KeyError, AttributeError) as error:
# TODO usersync should probably exit with non-zero exit code at the end,
# but sync should continue from this point so there are no partial
# updates
Expand Down

0 comments on commit f51f61a

Please sign in to comment.