Skip to content

Commit

Permalink
fix no such table test to work with mysql and pg
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
  • Loading branch information
Pierre Tardy committed Feb 26, 2015
1 parent 05cc1b9 commit 6589418
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions master/buildbot/db/dbconfig.py
Expand Up @@ -18,6 +18,7 @@
from buildbot.db import model
from buildbot.db import state
from sqlalchemy.exc import OperationalError
from sqlalchemy.exc import ProgrammingError


class FakeDBConnector(object):
Expand Down Expand Up @@ -61,12 +62,11 @@ def getDb(self):
db.state = state.StateConnectorComponent(db)
try:
self.objectid = db.state.thdGetObjectId(db_engine, self.name, "DbConfig")['id']
except OperationalError as e:
if "no such table" in str(e):
db.pool.engine.close()
return None
else:
raise
except (ProgrammingError, OperationalError):
# ProgrammingError: mysql&pg, OperationalError: sqlite
# assume db is not initialized
db.pool.engine.close()
return None
return db

def get(self, name, default=state.StateConnectorComponent.Thunk):
Expand Down

0 comments on commit 6589418

Please sign in to comment.