diff --git a/osclib/stagingapi.py b/osclib/stagingapi.py index 154183f1..11934285 100644 --- a/osclib/stagingapi.py +++ b/osclib/stagingapi.py @@ -26,6 +26,7 @@ from osc.core import http_PUT from osclib.comments import CommentAPI + class StagingAPI(object): """ Class containing various api calls to work with staging projects. @@ -67,8 +68,8 @@ class StagingAPI(object): return http_POST(url) except urllib2.HTTPError, e: if e.code == 504: - print "Timeout on {}".format(url) - return '' + print 'Timeout on {}'.format(url) + return '' if e.code / 100 == 5: print 'Retrying {}'.format(url) return self.retried_POST(url) @@ -97,7 +98,8 @@ class StagingAPI(object): for entry in ET.parse(root).getroot().findall('entry'): pkg = entry.attrib['name'] if pkg in ret and pkg != 'Test-DVD-x86_64': - raise BaseException('{} is defined in two projects'.format(pkg)) + msg = '{} is defined in two projects ({} and {})' + raise Exception(msg.format(pkg, ret[pkg], prj)) ret[pkg] = prj return ret @@ -402,7 +404,7 @@ class StagingAPI(object): append = False if append: author = get_request(self.apiurl, str(request_id)).get_creator() - data['requests'].append({'id': request_id, 'package': package, 'author': author }) + data['requests'].append({'id': request_id, 'package': package, 'author': author}) self.set_prj_pseudometa(project, data) def get_request_id_for_package(self, project, package): @@ -669,7 +671,8 @@ class StagingAPI(object): bestjobs = {} for job in jobs: if job['result'] != 'incomplete' and not job['clone_id']: - if job['test'] == 'miniuefi': continue + if job['test'] == 'miniuefi': + continue if job['name'] not in bestjobs or bestjobs[job['name']]['result'] != 'passed': bestjobs[job['name']] = job @@ -1086,7 +1089,7 @@ class StagingAPI(object): # OBS API to update a comment if comment['comment'].startswith('' % command]