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" slug: "%(id)s"
model: authentik_flows.flow model: authentik_flows.flow
state: absent 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) self.logger.debug("updated model", model=model)
elif state == BlueprintEntryDesiredState.ABSENT: elif state == BlueprintEntryDesiredState.ABSENT:
instance: Optional[Model] = serializer.instance instance: Optional[Model] = serializer.instance
if instance: if instance.pk:
instance.delete() instance.delete()
self.logger.debug("deleted model", mode=instance) self.logger.debug("deleted model", mode=instance)
continue continue