Reconnect to Gerrit database if needed

* jeepyb/gerritdb.py(connect): If the database connection is being
reused for a connect call, issue a ping and pass the reconnect
option so that a reconnection attempt will be made in the event the
socket has timed out or otherwise disconnected. Note that this only
works for the MySQLdb driver, so a different solution will likely be
needed for psycopg2. Alternatively, switching to an ORM like
sqlalchemy would get us this for free, but is a more involved
change.

Change-Id: I591d40998e208f18ac5c43bafd7bccb98be6a9c8
Closes-Story: #2000017
1 file changed