jedcunningham commented on code in PR #62737:
URL: https://github.com/apache/airflow/pull/62737#discussion_r2878816213


##########
providers/fab/src/airflow/providers/fab/auth_manager/security_manager/override.py:
##########
@@ -1739,10 +1740,29 @@ def add_permission_to_role(self, role: Role, 
permission: Permission | None) -> N
                 self.session.merge(role)
                 self.session.commit()
                 log.info(const.LOGMSG_INF_SEC_ADD_PERMROLE, permission, 
role.name)
+            except IntegrityError:
+                self.session.rollback()
+                if self._is_permission_assigned_to_role(role_id=role.id, 
permission_id=permission.id):
+                    log.debug("Permission '%s' already assigned to role '%s'", 
permission, role.name)
+                else:
+                    log.error(const.LOGMSG_ERR_SEC_ADD_PERMROLE, "Failed to 
assign permission after rollback")

Review Comment:
   This log message is still misleading.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to