Script result page omits Job-level failure reasons

Open Beginner friendly
#153 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start at the Script result page code that reads job.data['log'], then compare it with the Job runner’s use of job.log_entries and the Job Log tab. Update the result page to show the Job-level messages alongside the script log, and check that the disabled-script failure reason and other Job messages appear on the result page.

Written by the indexing model from the issue text.

Description

app: scripts severity: low status: backlog type: bug
Plugin Version

v0.0.1

NetBox Version

v4.7.1

Python Version

3.12

Steps to Reproduce
  1. Upload and activate a Project with a Script File, for example deploy.py:
    from netbox_scripts import Script
    
    
    class Hello(Script):
        def run(self, data, commit):
            self.log_success('Hello.')
    
  2. From the Script's Run tab, schedule a run a few minutes in the future.
  3. Disable the Script before the scheduled run starts.
  4. After the Job has run, refresh its result page.
Expected Behavior

The result page explains why the Job failed, even if the Script never started:

"Hello" was disabled after this run was requested, so it was not run.
Observed Behavior

The result page shows Failed, but the log is empty and no failure reason is displayed.

The reason is recorded in the Job's own log, accessible through the Script's Jobs tab and the Job's Log tab.

The result page currently reads only job.data['log'], while the Job runner records its messages in job.log_entries. This also hides other Job-level messages, including revision information, execution refusals, Script loading failures, and final failure summaries.

Reproduced on main (4a65dfe) and the #122 development tree with NetBox v4.7.1.

Related to #41 and #122, but separate from both.

Dominant language
Python
Stars
8
Forks
0
Avg merge
12h 34m
Merged PRs (30d)
57

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from netbox-community/netbox-scripts

All issues in netbox-community/netbox-scripts

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.