blueprints: fix error when entry with state absent doesn't exist

closes #4305

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-12-29 21:55:17 +01:00
parent 97513467ad
commit 68b58fb73c
No known key found for this signature in database
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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