Fix creating new Review Board databases via rb-site.

Review Request #34 — Created July 27, 2022 and updated — Latest diff uploaded

guest1753
Review Board
ceed1ba...
g
When creating a new site and a new database, we run through the
pre/post-upgrade steps in order to ensure that we have all the state set
the way we need it. These attempted to handle the case where a table
didn't yet exist, but the exception it was using was too specific. Some
database backends may raise an `OperationalError` in this case, while
others may raise a `ProgrammingError`.

We now catch the top-level exception, `DatabaseError`, in order to
handle this case for all databases.

We also handle unexpected errors raised from the pre/post-upgrade
functions. If any errors are raised in the pre step, we will immediately
fail the install/upgrade, along with showing a useful error. If any
errors are raised in the post step, we will continue on, but log a
similar error.

Testing Done:
Tested creating a new production database on MySQL, where the error
was initially hit. Saw the log information and the traceback.

Tested that the fix to using `DatabaseError` let the install proceed.

Simulated a failure in the post steps, and saw the logged error there.

Reviewed at https://reviews.reviewboard.org/r/12444/


Loading...