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:
parent
97513467ad
commit
68b58fb73c
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Reference in New Issue