Skip to content
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

Script Rest API has no results #13061

Closed
jiuka opened this issue Jun 30, 2023 · 6 comments
Closed

Script Rest API has no results #13061

jiuka opened this issue Jun 30, 2023 · 6 comments
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@jiuka
Copy link

jiuka commented Jun 30, 2023

NetBox version

v3.5.4

Python version

3.11

Steps to Reproduce

  1. Save this script into a file called bug.py
from extras.scripts import *


class Bug13061(Script):

    class Meta:
        name = "Demo for Bug13061"
        description = "Demo for Bug13061"

    def run(self, data, commit):
        self.log_success(f"Demo for Bug13061")
  1. Go to https://netbox.example.com/extras/scripts/add/
  2. Upload the bug.py file.
  3. Got to https://netbox.example.com/extras/scripts/bug/Bug13061/
  4. Click on Run Script
  5. Go to https://netbox.example.com/api/extras/scripts/bug.Bug13061/

Expected Behavior

The result should be job result like in the reports endpoint.

Observed Behavior

It is always null.

The job.name is just the name of the script class. When search for the result the script.name
is used and not the class_name therefore no results are found, unless the name ist set to the same value as the class_name.

@jiuka jiuka added the type: bug A confirmed report of unexpected behavior in the application label Jun 30, 2023
@abhi1693
Copy link
Member

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@abhi1693 abhi1693 added the status: revisions needed This issue requires additional information to be actionable label Jun 30, 2023
@jiuka
Copy link
Author

jiuka commented Jun 30, 2023

I hope it is detailed enough.

@jsenecal jsenecal added status: under review Further discussion is needed to determine this issue's scope and/or implementation and removed status: revisions needed This issue requires additional information to be actionable labels Jul 3, 2023
@bitcollector1
Copy link

I have the same issue. Here you can see an example of just (1) of my scripts reported correctly, even though all of them completed successfully.

Screenshot 2023-07-05 at 09 28 52

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Jul 10, 2023
@jeremystretch jeremystretch self-assigned this Jul 10, 2023
@jiuka
Copy link
Author

jiuka commented Jul 11, 2023

Hi @jeremystretch

This fixed the GUI but not the Rest API I made bug about. Should I create a new bug report or do you want to reopen this one?

Regards and many thanks for Netbox

Marius

@cholyoak
Copy link

That's right. There are still inconsistencies in calling .name instead of .class_name in netbox/extras/api/views.py and netbox/extras/management/commands/runscript.py (this affects running scripst from the command line too). I can share a patch if you like.

@jsenecal
Copy link
Contributor

jsenecal commented Jul 12, 2023

This fixed the GUI but not the Rest API I made bug about. Should I create a new bug report or do you want to reopen this one?

Regards and many thanks for Netbox

Marius

@jiuka Please open a new bug report with a reference to this issue as this has been merged into a release.
Thanks,

@cholyoak you could chime in that other issue should your comment be relevant to that issue as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

6 participants