Fix creating new Review Board databases via rb-site.

Review Request #12444 — Created July 8, 2022 and submitted — Latest diff uploaded

Information

Review Board
release-5.0.x

Reviewers

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.

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.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

orig
1
2

Commits

First Last Summary ID Author
Fix creating new Review Board databases via rb-site.
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.
4358a04f013b7a718bc59e90728fb557b80b9576 Christian Hammond
reviewboard/upgrade.py
reviewboard/cmdline/rbsite.py
Loading...