Error when executing custom scripts via the runscript management command #8003

Closed
opened 2025-12-29 20:31:03 +01:00 by adam · 0 comments
Owner

Originally created by @PhilKet on GitHub (May 4, 2023).

Originally assigned to: @arthanson on GitHub.

NetBox version

v3.5.0

Python version

3.10

Steps to Reproduce

  1. Upgrade Netbox from v3.4.10 to v3.5.0 (Docker)
  2. Upload any custom script (e.g. the example script from documentation)
  3. Run script

Expected Behavior

Script runs without error

Observed Behavior

If I execute the script via the WebGUI it is stuck at "Results pending...".
When I execute it on the CLI inside the Docker container, I get this error:

# python3 manage.py runscript --loglevel debug test.NewBranchScript
loaded config '/etc/netbox/config/configuration.py'
loaded config '/etc/netbox/config/extra.py'
loaded config '/etc/netbox/config/logging.py'
loaded config '/etc/netbox/config/plugins.py'
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 446, in execute_from_command_line
    utility.execute()
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, 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 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/opt/netbox/netbox/extras/management/commands/runscript.py", line 113, in handle
    job = Job.objects.create(
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 669, in create
    obj = self.model(**kwargs)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/base.py", line 565, in __init__
    raise TypeError(
TypeError: Job() got unexpected keyword arguments: 'instance'
Originally created by @PhilKet on GitHub (May 4, 2023). Originally assigned to: @arthanson on GitHub. ### NetBox version v3.5.0 ### Python version 3.10 ### Steps to Reproduce 1. Upgrade Netbox from v3.4.10 to v3.5.0 (Docker) 2. Upload any custom script (e.g. the example script from documentation) 3. Run script ### Expected Behavior Script runs without error ### Observed Behavior If I execute the script via the WebGUI it is stuck at "Results pending...". When I execute it on the CLI inside the Docker container, I get this error: ``` # python3 manage.py runscript --loglevel debug test.NewBranchScript loaded config '/etc/netbox/config/configuration.py' loaded config '/etc/netbox/config/extra.py' loaded config '/etc/netbox/config/logging.py' loaded config '/etc/netbox/config/plugins.py' 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 446, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, 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 402, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute output = self.handle(*args, **options) File "/opt/netbox/netbox/extras/management/commands/runscript.py", line 113, in handle job = Job.objects.create( File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/query.py", line 669, in create obj = self.model(**kwargs) File "/opt/netbox/venv/lib/python3.10/site-packages/django/db/models/base.py", line 565, in __init__ raise TypeError( TypeError: Job() got unexpected keyword arguments: 'instance' ```
adam added the type: bugstatus: accepted labels 2025-12-29 20:31:03 +01:00
adam closed this issue 2025-12-29 20:31:03 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8003