blueprints: fix error when imported blueprint is invalid (#5414)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-04-28 22:44:19 +03:00 committed by GitHub
parent 5830781a5a
commit af7cc8d42d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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: