Project

General

Profile

Actions

Bug #9010

open

[paddles] `rollback()` is used incorrectly

Added by Alfredo Deza over 9 years ago. Updated over 8 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
-
% Done:

0%

Source:
Development
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Crash signature (v1):
Crash signature (v2):

Description

In places like `paddles/controllers/runs.py` there are try/except blocks that catch non-altering database actions
that call `rollback()` which is meant to "roll back a transaction". It is usually there so that when a transaction that
is going to do a delete, update, or create action that requires a commit and that action creates an error it can be "rolled back".

This is an example of wrong usage of rollback:

def latest_runs(fields=None, count=conf.default_latest_runs_count, page=1):
    query = Run.query.order_by(Run.posted.desc())
    query = offset_query(query, page_size=count, page=page)
    runs = query.all()
    if fields:
        try:
            return [run.slice(fields) for run in runs]
        except AttributeError:
            rollback()
            error('/errors/invalid/',
                  'an invalid field was specified')
    return [run for run in runs]
Actions

Also available in: Atom PDF