소스 검색

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.
Arzhel Younsi 1 년 전
부모
커밋
b2bbdbf1d9
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      netbox/extras/management/commands/runscript.py

+ 1 - 1
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()
         )