handle gbs remotebuild build server connection timeout error
authorGuan Junchun <junchunx.guan@intel.com>
Wed, 23 May 2012 08:29:56 +0000 (16:29 +0800)
committerGuan Junchun <junchunx.guan@intel.com>
Wed, 23 May 2012 08:29:56 +0000 (16:29 +0800)
gitbuildsys/buildservice.py
gitbuildsys/cmd_remotebuild.py

index 1220205..b1dabe3 100644 (file)
@@ -295,8 +295,9 @@ class BuildService(object):
             if e.code == 404:
                 new_prj = True
             else:
-                raise e
-
+                raise errors.ObsError("%s" % e)
+        except urllib2.URLError, e:
+            raise errors.ObsError("%s" % e)
         return new_prj
 
     def genRequestInfo(self, reqid, show_detail = True):
index 3f6886f..5781fb8 100644 (file)
@@ -105,15 +105,15 @@ def do(opts, args):
 
     prj = obspkg.ObsProject(target_prj, apiurl = APISERVER, oscrc = oscrcpath)
     msger.info('checking status of obs project: %s ...' % target_prj)
-    if prj.is_new():
-        if opts.target_obsprj and not target_prj.startswith('home:%s:' % USER):
-            msger.error('no permission to create project %s, only subpackage '\
+    try:
+        if prj.is_new():
+            if opts.target_obsprj and not target_prj.startswith('home:%s:' % USER):
+                msger.error('no permission to create project %s, only subpackage '\
                         'of home:%s is allowed ' % (target_prj, USER))
-        msger.info('creating %s for package build ...' % target_prj)
-        try:
+            msger.info('creating %s for package build ...' % target_prj)
             prj.branch_from(base_prj)
-        except errors.ObsError, exc:
-            msger.error('%s' % exc)
+    except errors.ObsError, exc:
+        msger.error('%s' % exc)
 
     msger.info('checking out %s/%s to %s ...' % (target_prj, spec.name, tmpdir))
     localpkg = obspkg.ObsPackage(tmpdir, target_prj, spec.name,