[Piuparts-commits] [piuparts] 02/08: p-m: catch URLError, log it and abort without backtrace

Holger Levsen holger at moszumanska.debian.org
Mon Jul 20 08:48:55 UTC 2015


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

holger pushed a commit to branch develop
in repository piuparts.

commit e3a793f6e314981df18d96de65d1f9ff8a48565f
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun Jul 19 22:18:39 2015 +0200

    p-m: catch URLError, log it and abort without backtrace
    
    happens on (transient) network problems, e.g. restarting squid
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 debian/changelog           | 2 ++
 piuparts-master-backend.py | 8 ++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a6d4e2a..c27a24d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ piuparts (0.65) UNRELEASED; urgency=medium
     - Put package in 'dependency-does-not-exist' state if a pass/ log exists
       but a dependency has been removed from the archive since then.
   * piupartslib/open_packages_url(): support uncompressed Packages files.
+  * piuparts-master-backend.py:
+    - Catch URLError, log it and abort without backtrace.
   * scripts/post_distupgrade_exceptions:
     - Fix the /etc/nsswitch.conf wheezy -> jessie upgrade handling.
   * Add bug template for wheezy -> jessie -> stretch upgrades.
diff --git a/piuparts-master-backend.py b/piuparts-master-backend.py
index 2d0bbb0..e560adf 100644
--- a/piuparts-master-backend.py
+++ b/piuparts-master-backend.py
@@ -32,6 +32,7 @@ import os
 import fcntl
 import time
 import random
+from urllib2 import URLError
 
 import piupartslib
 from piupartslib.packagesdb import LogfileExists
@@ -421,8 +422,11 @@ def main():
     os.chdir(master_directory)
 
     m = Master(sys.stdin, sys.stdout)
-    while m.do_transaction():
-        pass
+    try:
+        while m.do_transaction():
+            pass
+    except URLError as e:
+        logging.error("ABORT: URLError: " + str(e.reason))
 
     logging.debug(timestamp() + " disconnected")
 

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



More information about the Piuparts-commits mailing list