Improve error message.

This commit is contained in:
Alberto Planas 2014-06-06 16:22:37 +02:00
parent d89bafcc5e
commit 4ad50e1aba

View File

@ -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,7 +68,7 @@ class StagingAPI(object):
return http_POST(url)
except urllib2.HTTPError, e:
if e.code == 504:
print "Timeout on {}".format(url)
print 'Timeout on {}'.format(url)
return '<status code="timeout"/>'
if e.code / 100 == 5:
print 'Retrying {}'.format(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