Fix creating new Review Board databases via rb-site.

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

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/


Description From Last Updated

1231231

guest1753guest1753

112314

guest1753guest1753
guest1753
  1. 
      
  2. 
      
guest1753
  1. 
      
  2. reviewboard/cmdline/rbsite.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    1231231

  3. reviewboard/upgrade.py (Diff revision 1)
     
     
  4. 
      
guest9837
  1. Ship It!
  2. 
      
Loading...