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 job count is incorrect #14572

Closed
DanSheps opened this issue Dec 20, 2023 · 1 comment · Fixed by #14754
Closed

Script job count is incorrect #14572

DanSheps opened this issue Dec 20, 2023 · 1 comment · Fixed by #14754
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

@DanSheps
Copy link
Member

Deployment Type

Self-hosted

NetBox Version

v3.6.7

Python Version

3.10

Steps to Reproduce

  1. Create a script file:
from extras.scripts import Script


class TestScript(Script):
    name = 'Test'
    description = ''

    def run(self, data, commit=True):
        self.log_success('Finished Script')


class TestScriptNew(Script):
    name = 'Test New'
    description = ''

    def run(self, data, commit=True):
        self.log_success('Finished Script 2')
  1. Upload to NetBox
  2. Run Test
  3. View Test New

Expected Behavior

Job tab badge has "0"

Observed Behavior

Job tab badge has >0

@DanSheps DanSheps added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available labels Dec 20, 2023
@DanSheps DanSheps self-assigned this Dec 20, 2023
@DanSheps
Copy link
Member Author

This is caused by the badge querying module.jobs without filtering for the script name.

@DanSheps DanSheps closed this as completed Jan 9, 2024
@DanSheps DanSheps removed their assignment Jan 9, 2024
@DanSheps DanSheps reopened this Jan 9, 2024
@DanSheps DanSheps self-assigned this Jan 9, 2024
DanSheps added a commit that referenced this issue Jan 9, 2024
jeremystretch added a commit that referenced this issue Jan 22, 2024
…ic named job (#14754)

* Fixes #14572 - Constrains JobView (and related views) badge to specific named job

* Adjust report views to resolve same problem

* Fixed PEP8 error

* Update netbox/templates/extras/script/base.html

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* Move function to method on PythonModuleMixin

* Update netbox/extras/views.py

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* Update netbox/extras/views.py

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* Update netbox/extras/views.py

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* Update netbox/extras/views.py

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>

* Update to mixin and view

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2024
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
1 participant