Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PhilKet opened this issue May 4, 2023 · 0 comments · Fixed by #12486
Closed

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

PhilKet opened this issue May 4, 2023 · 0 comments · Fixed by #12486
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@PhilKet
Copy link

PhilKet commented May 4, 2023

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'
@PhilKet PhilKet added the type: bug A confirmed report of unexpected behavior in the application label May 4, 2023
@jeremystretch jeremystretch changed the title Custom scripts don't work after upgrade to v3.5.0 Error when executing custom scripts via the runscript management command May 4, 2023
@jeremystretch jeremystretch added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label May 4, 2023
@arthanson arthanson self-assigned this May 4, 2023
@arthanson arthanson removed the status: under review Further discussion is needed to determine this issue's scope and/or implementation label May 4, 2023
@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label May 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants