From b9294fd9ad4e2050b0d89e70bb44f96ac709ae2a Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 23 Aug 2022 21:15:48 +0200 Subject: [PATCH] blueprints: fix unbound error Signed-off-by: Jens Langhammer --- authentik/blueprints/v1/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authentik/blueprints/v1/tasks.py b/authentik/blueprints/v1/tasks.py index 2cf355a0d..793b50ae2 100644 --- a/authentik/blueprints/v1/tasks.py +++ b/authentik/blueprints/v1/tasks.py @@ -144,6 +144,8 @@ def apply_blueprint(self: MonitoredTask, instance_pk: str): blueprint_content = instance.retrieve() file_hash = sha512(blueprint_content.encode()).hexdigest() importer = Importer(blueprint_content, instance.context) + if importer.blueprint.metadata: + instance.metadata = asdict(importer.blueprint.metadata) valid, logs = importer.validate() if not valid: instance.status = BlueprintInstanceStatus.ERROR @@ -170,6 +172,4 @@ def apply_blueprint(self: MonitoredTask, instance_pk: str): instance.status = BlueprintInstanceStatus.ERROR self.set_status(TaskResult(TaskResultStatus.ERROR).with_error(exc)) finally: - if importer.blueprint.metadata: - instance.metadata = asdict(importer.blueprint.metadata) instance.save()