blueprints: fix error when imported blueprint is invalid (#5414)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
5830781a5a
commit
af7cc8d42d
|
@ -49,7 +49,8 @@ class BlueprintInstanceSerializer(ModelSerializer):
|
||||||
context = self.instance.context if self.instance else {}
|
context = self.instance.context if self.instance else {}
|
||||||
valid, logs = Importer(content, context).validate()
|
valid, logs = Importer(content, context).validate()
|
||||||
if not valid:
|
if not valid:
|
||||||
raise ValidationError(_("Failed to validate blueprint"), *[x["msg"] for x in logs])
|
text_logs = "\n".join([x["event"] for x in logs])
|
||||||
|
raise ValidationError(_("Failed to validate blueprint: %(logs)s" % {"logs": text_logs}))
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def validate(self, attrs: dict) -> dict:
|
def validate(self, attrs: dict) -> dict:
|
||||||
|
|
Reference in a new issue