blueprints: fix unbound error
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
13a302cdad
commit
b9294fd9ad
|
@ -144,6 +144,8 @@ def apply_blueprint(self: MonitoredTask, instance_pk: str):
|
||||||
blueprint_content = instance.retrieve()
|
blueprint_content = instance.retrieve()
|
||||||
file_hash = sha512(blueprint_content.encode()).hexdigest()
|
file_hash = sha512(blueprint_content.encode()).hexdigest()
|
||||||
importer = Importer(blueprint_content, instance.context)
|
importer = Importer(blueprint_content, instance.context)
|
||||||
|
if importer.blueprint.metadata:
|
||||||
|
instance.metadata = asdict(importer.blueprint.metadata)
|
||||||
valid, logs = importer.validate()
|
valid, logs = importer.validate()
|
||||||
if not valid:
|
if not valid:
|
||||||
instance.status = BlueprintInstanceStatus.ERROR
|
instance.status = BlueprintInstanceStatus.ERROR
|
||||||
|
@ -170,6 +172,4 @@ def apply_blueprint(self: MonitoredTask, instance_pk: str):
|
||||||
instance.status = BlueprintInstanceStatus.ERROR
|
instance.status = BlueprintInstanceStatus.ERROR
|
||||||
self.set_status(TaskResult(TaskResultStatus.ERROR).with_error(exc))
|
self.set_status(TaskResult(TaskResultStatus.ERROR).with_error(exc))
|
||||||
finally:
|
finally:
|
||||||
if importer.blueprint.metadata:
|
|
||||||
instance.metadata = asdict(importer.blueprint.metadata)
|
|
||||||
instance.save()
|
instance.save()
|
||||||
|
|
Reference in a new issue