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

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

Closed
craized opened this issue Sep 27, 2024 · 0 comments · Fixed by #17764
Closed

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

craized opened this issue Sep 27, 2024 · 0 comments · Fixed by #17764
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

@craized
Copy link

craized commented Sep 27, 2024

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
@craized craized added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Sep 27, 2024
@arthanson arthanson added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Sep 30, 2024
@arthanson arthanson self-assigned this Oct 10, 2024
@arthanson arthanson added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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

Successfully merging a pull request may close this issue.

2 participants