diff --git a/authentik/blueprints/tests/fixtures/state_absent.yaml b/authentik/blueprints/tests/fixtures/state_absent.yaml index d73d929e2..c75d9e3df 100644 --- a/authentik/blueprints/tests/fixtures/state_absent.yaml +++ b/authentik/blueprints/tests/fixtures/state_absent.yaml @@ -5,3 +5,9 @@ entries: slug: "%(id)s" model: authentik_flows.flow state: absent + - identifiers: + name: "%(id)s" + expression: | + return True + model: authentik_policies_expression.expressionpolicy + state: absent diff --git a/authentik/blueprints/v1/importer.py b/authentik/blueprints/v1/importer.py index 7ba2468f4..6b32559ba 100644 --- a/authentik/blueprints/v1/importer.py +++ b/authentik/blueprints/v1/importer.py @@ -268,7 +268,7 @@ class Importer: self.logger.debug("updated model", model=model) elif state == BlueprintEntryDesiredState.ABSENT: instance: Optional[Model] = serializer.instance - if instance: + if instance.pk: instance.delete() self.logger.debug("deleted model", mode=instance) continue