[Qa-jenkins-scm] [jenkins.debian.net] 03/06: reproducible: common.py: catch psycopg2.OperationalError when the connection timeouts in start_udd_connection to output a useful error message

Holger Levsen holger at moszumanska.debian.org
Tue Aug 18 11:36:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit b2ef162763e9f5304d9e824e8211b87a68f461d1
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Mon Aug 17 10:06:59 2015 +0000

    reproducible: common.py: catch psycopg2.OperationalError when the connection timeouts in start_udd_connection to output a useful error message
---
 bin/reproducible_common.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index c147511..6ddcf39 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:')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list