diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2015-08-17 10:06:59 +0000 |
---|---|---|
committer | Mattia Rizzolo <mattia@mapreri.org> | 2015-08-17 10:27:10 +0000 |
commit | b2ef162763e9f5304d9e824e8211b87a68f461d1 (patch) | |
tree | 21c3ce76caa67b293757c93db6499a5a173df0d5 | |
parent | 5bfdb5e2a7dcc142e00a73a3c4c7652434abb5fd (diff) | |
download | jenkins.debian.net-b2ef162763e9f5304d9e824e8211b87a68f461d1.tar.xz |
reproducible: common.py: catch psycopg2.OperationalError when the connection timeouts in start_udd_connection to output a useful error message
-rwxr-xr-x | bin/reproducible_common.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py index c1475117..6ddcf398 100755 --- a/bin/reproducible_common.py +++ b/bin/reproducible_common.py @@ -328,6 +328,15 @@ def start_udd_connection(): password=password, connect_timeout=5, ) + except psycopg2.OperationalError as err: + if str(err) == 'timeout expired\n': + log.error('Connection to the UDD database replice timed out. ' + 'Probably the machine is offline or just unavailable.') + log.error('Failing nicely anyway, all queries will return an ' + 'empty response.') + return None + else: + raise except: log.error('Erorr connecting to the UDD database replica.' + 'The full error is:') |