[bts-link] 29/31: Add a new exception for cases where connection or auth fails

Sandro Tosi morph at moszumanska.debian.org
Wed Dec 30 01:38:02 UTC 2015


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

morph pushed a commit to branch master
in repository bts-link.

commit 3550d6a452b6fb9bdb4516892da3eff7b9add783
Author: Olivier Berger <olivier.berger at telecom-sudparis.eu>
Date:   Tue Dec 8 13:43:35 2015 +0100

    Add a new exception for cases where connection or auth fails
    
    This helps avoiding further polling a remote whose endpoint is failing
---
 remote/__init__.py |  2 +-
 remote/base.py     | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/remote/__init__.py b/remote/__init__.py
index bd1de02..d46f230 100644
--- a/remote/__init__.py
+++ b/remote/__init__.py
@@ -31,7 +31,7 @@
 
 import commands
 
-from base import RemoteBts, ParseExn, DupeExn, NoStatusExn
+from base import RemoteBts, ParseExn, DupeExn, NoStatusExn, ConnectionFailedExn
 
 def wget(uri, cookies=None):
     opts = []
diff --git a/remote/base.py b/remote/base.py
index 1bd79e5..1f72f9f 100644
--- a/remote/base.py
+++ b/remote/base.py
@@ -57,6 +57,13 @@ class DupeExn(Exception):
     def __str__(self):
         return  "Does not deals dupes: [%s]" % (self.url)
 
+class ConnectionFailedExn(Exception):
+    def __init__(self, remote, reason):
+        self.remote = remote
+        self.reason = reason
+    
+    def __str__(self):
+        return 'Could not connect to %s: [%s]' % (self.remote, self.reason)
 
 def maketoken(val):
     if val and val.lower() == 'none': return None
@@ -313,6 +320,12 @@ class RemoteBts:
             except DupeExn,  e:
                 status['E'] += 1
                 warn("E: pkg=%s, bug=%s, msg=%s" % (btsbug.srcpackage, btsbug.id, str(e)))
+            # Connection or Authentication issue
+            except ConnectionFailedExn, e:
+                status['E'] += 1
+                warn("E: pkg=%s, bug=%s, msg=%s" % (btsbug.srcpackage, btsbug.id, str(e)))
+                # no need to keep polling the rest of the bugs on the same endpoint
+                break
             except NoStatusExn,  e:
                 status['I'] += 1
                 warn("I: pkg=%s, bug=%s, msg=%s" % (btsbug.srcpackage, btsbug.id, str(e)))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bts-link/bts-link.git



More information about the bts-link-commits mailing list