diff --git a/authentik/events/monitored_tasks.py b/authentik/events/monitored_tasks.py index 63330cddf..1213d85b7 100644 --- a/authentik/events/monitored_tasks.py +++ b/authentik/events/monitored_tasks.py @@ -46,7 +46,7 @@ class TaskResult: def with_error(self, exc: Exception) -> "TaskResult": """Since errors might not always be pickle-able, set the traceback""" - self.messages.extend(exception_to_string(exc).splitlines()) + self.messages.append(str(exc)) return self diff --git a/authentik/sources/ldap/api.py b/authentik/sources/ldap/api.py index 62c8478ed..952fa7e86 100644 --- a/authentik/sources/ldap/api.py +++ b/authentik/sources/ldap/api.py @@ -109,9 +109,8 @@ class LDAPSourceViewSet(UsedByMixin, ModelViewSet): GroupLDAPSynchronizer, MembershipLDAPSynchronizer, ]: - task = TaskInfo.by_name( - f"ldap_sync_{source.slug}_{sync_class.__name__.replace('LDAPSynchronizer', '').lower()}" - ) + sync_name = sync_class.__name__.replace("LDAPSynchronizer", "").lower() + task = TaskInfo.by_name(f"ldap_sync_{source.slug}_{sync_name}") if task: results.append(task) return Response(TaskSerializer(results, many=True).data) diff --git a/authentik/sources/ldap/sync/groups.py b/authentik/sources/ldap/sync/groups.py index 99c1793ad..7a305a028 100644 --- a/authentik/sources/ldap/sync/groups.py +++ b/authentik/sources/ldap/sync/groups.py @@ -29,7 +29,7 @@ class GroupLDAPSynchronizer(BaseLDAPSynchronizer): group_dn = self._flatten(self._flatten(group.get("entryDN", group.get("dn")))) if self._source.object_uniqueness_field not in attributes: self.message( - f"Cannot find uniqueness field in attributes: '{group_dn}", + f"Cannot find uniqueness field in attributes: '{group_dn}'", attributes=attributes.keys(), dn=group_dn, ) diff --git a/authentik/sources/ldap/sync/users.py b/authentik/sources/ldap/sync/users.py index 8038303da..c4ae4869e 100644 --- a/authentik/sources/ldap/sync/users.py +++ b/authentik/sources/ldap/sync/users.py @@ -31,7 +31,7 @@ class UserLDAPSynchronizer(BaseLDAPSynchronizer): user_dn = self._flatten(user.get("entryDN", user.get("dn"))) if self._source.object_uniqueness_field not in attributes: self.message( - f"Cannot find uniqueness field in attributes: '{user_dn}", + f"Cannot find uniqueness field in attributes: '{user_dn}'", attributes=attributes.keys(), dn=user_dn, )