blueprints: use correct log level when re-logging import validation logs

closes #3483

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-08-28 16:07:48 +02:00
parent 5886688fae
commit d3466ceef8
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,6 @@
"""Apply blueprint from commandline"""
from sys import exit as sys_exit
from django.core.management.base import BaseCommand, no_translations
from structlog.stdlib import get_logger
@ -20,8 +22,9 @@ class Command(BaseCommand):
valid, logs = importer.validate()
if not valid:
for log in logs:
LOGGER.debug(**log)
raise ValueError("blueprint invalid")
getattr(LOGGER, log.pop("log_level"))(**log)
self.stderr.write("blueprint invalid")
sys_exit(1)
importer.apply()
def add_arguments(self, parser):