retry the obs operation when get ObsError
authorHasan Wan <hasan.wan@intel.com>
Mon, 4 Nov 2013 07:48:18 +0000 (09:48 +0200)
committerGerrit Code Review <gerrit2@otctools.jf.intel.com>
Mon, 4 Nov 2013 07:54:44 +0000 (23:54 -0800)
Fixes: #1103

Change-Id: I68d5935133b94167456a2d81bc747bdaa5e14342
Signed-off-by: Hasan Wan <hasan.wan@intel.com>
common/buildservice.py

index df66b83..1debc4c 100644 (file)
@@ -31,6 +31,8 @@ from gitbuildsys.errors import ObsError
 from gitbuildsys.oscapi import OSC
 from gitbuildsys.utils import Temp
 
+from common.utils import retry
+
 from osc import conf, core
 
 
@@ -220,6 +222,15 @@ class BuildService(OSC):
         # the result, in unicode string
         return reqinfo
 
+    @retry()
+    def exists(self, prj, pkg=''):
+        """ Overwrite the exists function with retry decorator
+        """
+        try:
+            return super(BuildService, self).exists(prj, pkg)
+        except ObsError
+            return False
+
     def get_request_list(self, dst_prj, dst_pkg, user='', req_type='', \
             req_state=()):
         """Get already existing request list to the same obs project