From b2bbdbf1d90652e5b6edef3d0e34adf68d6887a5 Mon Sep 17 00:00:00 2001 From: Arzhel Younsi Date: Fri, 30 Aug 2024 16:59:47 +0200 Subject: [PATCH] runscript: use the previously defined "user" There is already a logic set earlier in the code to define "user" if --user is passed as parameter, and default to the user with the lowest ID no none is provided. This patch uses this "user" to run the job instead of always applying the default. --- netbox/extras/management/commands/runscript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/extras/management/commands/runscript.py b/netbox/extras/management/commands/runscript.py index ef1bd5141..16f297710 100644 --- a/netbox/extras/management/commands/runscript.py +++ b/netbox/extras/management/commands/runscript.py @@ -125,7 +125,7 @@ class Command(BaseCommand): job = Job.objects.create( object=module, name=script.class_name, - user=User.objects.filter(is_superuser=True).order_by('pk')[0], + user=user, job_id=uuid.uuid4() )