[csw-devel] SF.net SVN: gar:[20025] csw/mgar/gar/v2/lib/python/safe_remove_package.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Jan 4 18:32:58 CET 2013


Revision: 20025
          http://gar.svn.sourceforge.net/gar/?rev=20025&view=rev
Author:   wahwah
Date:     2013-01-04 17:32:58 +0000 (Fri, 04 Jan 2013)
Log Message:
-----------
safe-remove-package: Handle missing

Handle an exception when retrieving an URL via REST.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/safe_remove_package.py

Modified: csw/mgar/gar/v2/lib/python/safe_remove_package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/safe_remove_package.py	2013-01-04 17:32:32 UTC (rev 20024)
+++ csw/mgar/gar/v2/lib/python/safe_remove_package.py	2013-01-04 17:32:58 UTC (rev 20025)
@@ -19,6 +19,7 @@
 import sys
 import os
 import cjson
+import urllib2
 
 USAGE = """%prog --os-releases=SunOS5.10,SunOS5.11 -c <catalogname>
 
@@ -114,7 +115,12 @@
         logging.info("%s is an obsolete OS release. Skipping.", osrel)
         continue
       for arch in common_constants.PHYSICAL_ARCHITECTURES:
-        pkg_simple = rest_client.Srv4ByCatalogAndCatalogname(UNSTABLE, arch, osrel, catalogname)
+        try:
+          pkg_simple = rest_client.Srv4ByCatalogAndCatalogname(UNSTABLE, arch, osrel, catalogname)
+        except urllib2.HTTPError, e:
+          logging.warning("could not fetch %r from %s/%s: %s",
+                          catalogname, arch, osrel, e)
+          pkg_simple = None
         if not pkg_simple:
           # Maybe we were given a pkgname instead of a catalogname? We can try
           # that before failing.

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list