manage.py runscript broken in 4.1.5 #10422

Closed
opened 2025-12-29 21:31:14 +01:00 by adam · 3 comments
Owner

Originally created by @llamafilm on GitHub (Oct 30, 2024).

Deployment Type

Self-hosted

Triage priority

I'm a NetBox Labs customer

NetBox Version

v4.1.5

Python Version

3.12

Steps to Reproduce

  1. Install Netbox from this commit 5f94dff815
  2. Run a script using manage.py runscript

Expected Behavior

no error

Observed Behavior

This looks like the same issue as #17885. This commit fixes the issue when running scripts in the GUI, but it's still broken in the CLI.

$ /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py runscript update_telegraf.UpdateTelegraf --commit
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.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/netbox/venv/lib/python3.12/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.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox-5f94dff81512e5fb687ccbc71883b2d629b1d091/netbox/extras/management/commands/runscript.py", line 85, in handle
    job = ScriptJob.enqueue(
          ^^^^^^^^^^^^^^^^^^
  File "/opt/netbox-5f94dff81512e5fb687ccbc71883b2d629b1d091/netbox/netbox/jobs.py", line 106, in enqueue
    return Job.enqueue(cls.handle, name=name, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox-5f94dff81512e5fb687ccbc71883b2d629b1d091/netbox/core/models/jobs.py", line 236, in enqueue
    job.full_clean()
  File "/opt/netbox/venv/lib/python3.12/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.']}
Originally created by @llamafilm on GitHub (Oct 30, 2024). ### Deployment Type Self-hosted ### Triage priority I'm a NetBox Labs customer ### NetBox Version v4.1.5 ### Python Version 3.12 ### Steps to Reproduce 1. Install Netbox from this commit 5f94dff81512e5fb687ccbc71883b2d629b1d091 2. Run a script using `manage.py runscript` ### Expected Behavior no error ### Observed Behavior This looks like the same issue as #17885. This commit fixes the issue when running scripts in the GUI, but it's still broken in the CLI. ``` $ /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py runscript update_telegraf.UpdateTelegraf --commit 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.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib/python3.12/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.12/site-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-5f94dff81512e5fb687ccbc71883b2d629b1d091/netbox/extras/management/commands/runscript.py", line 85, in handle job = ScriptJob.enqueue( ^^^^^^^^^^^^^^^^^^ File "/opt/netbox-5f94dff81512e5fb687ccbc71883b2d629b1d091/netbox/netbox/jobs.py", line 106, in enqueue return Job.enqueue(cls.handle, name=name, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox-5f94dff81512e5fb687ccbc71883b2d629b1d091/netbox/core/models/jobs.py", line 236, in enqueue job.full_clean() File "/opt/netbox/venv/lib/python3.12/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.']} ```
adam added the type: bugstatus: duplicatenetbox labels 2025-12-29 21:31:14 +01:00
adam closed this issue 2025-12-29 21:31:15 +01:00
Author
Owner

@jhofmueller commented on GitHub (Oct 30, 2024):

For me it does not work via the UI either. Just Tested with this very simple script:

class TestScript(Script):
    class Meta:
        name = "TestScript"

    def run(self, data, commit):
        self.log_info('Script started.')
        self.log_success('Script finished.')

got

Server Error

There was a problem with your request. Please contact an administrator.
The complete exception is provided below:
<class 'django.core.exceptions.ValidationError'>

{'name': ['This field cannot be blank.']}

Python version: 3.12.3
NetBox version: 4.1.5
Plugins: 
  netbox_dns: 1.1.5
  netbox_secrets: 2.1.0

If further assistance is required, please post to the [NetBox discussion forum](https://github.com/netbox-community/netbox/discussions) on GitHub.
[Home Page](https://localhost/)

@jhofmueller commented on GitHub (Oct 30, 2024): For me it does not work via the UI either. Just Tested with this very simple script: ``` class TestScript(Script): class Meta: name = "TestScript" def run(self, data, commit): self.log_info('Script started.') self.log_success('Script finished.') ``` got ``` Server Error There was a problem with your request. Please contact an administrator. The complete exception is provided below: <class 'django.core.exceptions.ValidationError'> {'name': ['This field cannot be blank.']} Python version: 3.12.3 NetBox version: 4.1.5 Plugins: netbox_dns: 1.1.5 netbox_secrets: 2.1.0 If further assistance is required, please post to the [NetBox discussion forum](https://github.com/netbox-community/netbox/discussions) on GitHub. [Home Page](https://localhost/) ```
Author
Owner

@ly-sona commented on GitHub (Oct 30, 2024):

having the exact same issue

@ly-sona commented on GitHub (Oct 30, 2024): having the exact same issue
Author
Owner

@theobarrague commented on GitHub (Oct 31, 2024):

Same issue
2024-10-31 13:18:06 UTC 3b9349c1ea55 NetBox Community v4.1.5 (docker)

@theobarrague commented on GitHub (Oct 31, 2024): Same issue 2024-10-31 13:18:06 UTC 3b9349c1ea55 NetBox Community v4.1.5 (docker)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10422