Distinguish expected script failures from unexpected errors

Open
#23 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start by comparing the script execution paths with NetBox's netbox/netbox/jobs.py and its existing Job statuses and handling. Done means AbortScript produces Failed, unhandled exceptions produce Errored, diagnostics and log sanitization remain useful, rollback behavior is documented, and log_failure() retains its logging-only semantics.

Written by the indexing model from the issue text.

Description

app: scripts complexity: medium status: backlog type: feature
Plugin Version

v0.0.1

Proposed functionality

Use the final Job status to distinguish success, an intentional refusal, and an unexpected error. AbortScript should result in Failed, while an unhandled exception should result in Errored. Both currently produce a failed Job.

Apply this consistently across execution paths, preserve useful diagnostics and log sanitization, and document the rollback behavior.

Keep log_failure() as a logging operation unless a separate compatibility decision changes it. This status change should not give logging calls new transaction semantics.

Use case

A deployment script may correctly stop because a prerequisite is missing. Operators and automation need to distinguish that outcome from a programming error without reading the entire log.

Related request: netbox-community/netbox#22951.

External dependencies

Reuse the existing statuses and handling in NetBox's Job runner. No new package or service is expected.

Dominant language
Python
Stars
8
Forks
0
Avg merge
9h 56m
Merged PRs (30d)
29

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.