Fix logger for ScriptJob

This commit is contained in:
Alexander Haase 2024-07-24 12:58:01 +02:00
parent 7d15ec0bbb
commit 9f1989c179

View File

@ -33,6 +33,9 @@ class ScriptJob(BackgroundJob):
data: A dictionary of data to be passed to the script upon execution
commit: Passed through to Script.run()
"""
logger = logging.getLogger(f"netbox.scripts.{script.full_name}")
logger.info(f"Running script (commit={commit})")
try:
try:
with transaction.atomic():
@ -87,9 +90,6 @@ class ScriptJob(BackgroundJob):
"""
script = ScriptModel.objects.get(pk=job.object_id).python_class()
logger = logging.getLogger(f"netbox.scripts.{script.full_name}")
logger.info(f"Running script (commit={commit})")
# Add files to form data
if request:
files = request.FILES