# Loading permissions to MongoDB if there is not any permission.
if not records or (len(records) == 1 and records[0]["name"] == "admin"):
with open(self.roles_to_operations_file, "r") as stream:
- roles_to_operations_yaml = yaml.load(stream)
+ roles_to_operations_yaml = yaml.load(stream, Loader=yaml.Loader)
role_names = []
for role_with_operations in roles_to_operations_yaml["roles"]:
self.backend.update_user({"_id": user_admin_id,
"add_project_role_mappings": [{"project": pid, "role": role_id}]})
self.logger.info("Added role system admin to user='{}' project=admin".format(user_admin_id))
- except Exception:
- pass
+ except Exception as e:
+ self.logger.error("Error in Authorization DataBase initialization: {}: {}".format(type(e).__name__, e))
self.load_operation_to_allowed_roles()