manage.py runscript - Name cannot be blank #10436

Closed
opened 2025-12-29 21:31:27 +01:00 by adam · 1 comment
Owner

Originally created by @aroth01 on GitHub (Nov 4, 2024).

Deployment Type

Self-hosted

Triage priority

I volunteer to perform this work (if approved)

NetBox Version

v4.1.6

Python Version

3.10

Steps to Reproduce

  1. Execute ./manage.py runscript <file_name>.<script_name>
  2. Script will return the following traceback.

Traceback (most recent call last):
File "/opt/netbox/netbox/./manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, **options)
File "/opt/netbox/netbox/extras/management/commands/runscript.py", line 85, in handle
job = ScriptJob.enqueue(
File "/opt/netbox/netbox/netbox/jobs.py", line 106, in enqueue
return Job.enqueue(cls.handle, name=name, *args, **kwargs)
File "/opt/netbox/netbox/core/models/jobs.py", line 236, in enqueue
job.full_clean()
File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/base.py", line 1561, in full_clean
raise ValidationError(errors)
django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']}

Expected Behavior

Script should run and return result directly from script not from runscript.

Observed Behavior

django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']}

Originally created by @aroth01 on GitHub (Nov 4, 2024). ### Deployment Type Self-hosted ### Triage priority I volunteer to perform this work (if approved) ### NetBox Version v4.1.6 ### Python Version 3.10 ### Steps to Reproduce 1. Execute ./manage.py runscript <file_name>.<script_name> 2. Script will return the following traceback. Traceback (most recent call last): File "/opt/netbox/netbox/./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) File "/opt/netbox/netbox/extras/management/commands/runscript.py", line 85, in handle job = ScriptJob.enqueue( File "/opt/netbox/netbox/netbox/jobs.py", line 106, in enqueue return Job.enqueue(cls.handle, name=name, *args, **kwargs) File "/opt/netbox/netbox/core/models/jobs.py", line 236, in enqueue job.full_clean() File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/base.py", line 1561, in full_clean raise ValidationError(errors) django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']} ### Expected Behavior Script should run and return result directly from script not from runscript. ### Observed Behavior django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']}
adam added the type: bug label 2025-12-29 21:31:27 +01:00
adam closed this issue 2025-12-29 21:31:28 +01:00
Author
Owner

@aroth01 commented on GitHub (Nov 4, 2024):

If I add name=script_name to runscript line 97 after commit on netbox/extrax/management/commands/runscript.py for handle() it will start to work again. I can submit a PR with this fix if its the correct one.

@aroth01 commented on GitHub (Nov 4, 2024): If I add name=script_name to runscript line 97 after commit on netbox/extrax/management/commands/runscript.py for handle() it will start to work again. I can submit a PR with this fix if its the correct one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10436