Skip to content

Report raises AbortTransaction() when commit=False and log_failure() has been used #17635

Closed
@craized

Description

Deployment Type

Self-hosted

NetBox Version

v4.1.2

Python Version

3.11

Steps to Reproduce

Create a script that logs a failure. Run the script with commit=False

from extras.scripts import Script

class LogFailure(Script):
  description = "Log one failure"

  def test_error_behavior(self):
    self.log_failure("This is a test failure, not a script failure")

Expected Behavior

The script will log one 'Failure' line, rollback database changes, and complete

Observed Behavior

The script logs appropriate, but adds an additional failure, as show below, before rolling back DB changes

An exception occurred: AbortTransaction:

Traceback (most recent call last):
  File "/opt/netbox/netbox/extras/jobs.py", line 47, in run_script
    raise AbortTransaction()
utilities.exceptions.AbortTransaction

Metadata

Assignees

Labels

severity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions