Merge pull request #996 from mimi1vx/pep8-bot
openqa-maintenance: Reformat to be more pep8 comfortable
This commit is contained in:
commit
1d0a291d09
@ -131,6 +131,7 @@ class Update(object):
|
||||
|
||||
return 'unknown'
|
||||
|
||||
|
||||
class SUSEUpdate(Update):
|
||||
|
||||
def repo_prefix(self):
|
||||
@ -205,6 +206,7 @@ class SUSEUpdate(Update):
|
||||
|
||||
return settings
|
||||
|
||||
|
||||
class openSUSEUpdate(Update):
|
||||
|
||||
def calculate_lastest_good_updates(self, openqa, settings):
|
||||
@ -219,9 +221,9 @@ class openSUSEUpdate(Update):
|
||||
'limit': 100 # this needs increasing if we ever get *monster* coverage for released updates
|
||||
})['jobs']
|
||||
# check all publishing jobs per build and reject incomplete builds
|
||||
builds = dict()
|
||||
builds = {}
|
||||
for job in j:
|
||||
if not 'PUBLISH_HDD_1' in job['settings']:
|
||||
if 'PUBLISH_HDD_1' not in job['settings']:
|
||||
continue
|
||||
if job['result'] == 'passed' or job['result'] == 'softfailed':
|
||||
builds.setdefault(job['settings']['BUILD'], 'passed')
|
||||
@ -241,7 +243,7 @@ class openSUSEUpdate(Update):
|
||||
lastgood_suffix = suffix
|
||||
elif prefix == lastgood_prefix and suffix > lastgood_suffix:
|
||||
lastgood_suffix = suffix
|
||||
except:
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
if lastgood_prefix:
|
||||
@ -263,7 +265,8 @@ class openSUSEUpdate(Update):
|
||||
# - added packages
|
||||
# - conflicts with installed packages (e.g sendmail vs postfix)
|
||||
settings['INSTALL_PACKAGES'] = ' '.join(set([p.name for p in packages]))
|
||||
settings['VERIFY_PACKAGE_VERSIONS'] = ' '.join(['{} {}-{}'.format(p.name, p.version, p.release) for p in packages])
|
||||
settings['VERIFY_PACKAGE_VERSIONS'] = ' '.join(
|
||||
['{} {}-{}'.format(p.name, p.version, p.release) for p in packages])
|
||||
|
||||
settings['ZYPPER_ADD_REPOS'] = settings['INCIDENT_REPO']
|
||||
settings['ADDONURL'] = settings['INCIDENT_REPO']
|
||||
@ -394,7 +397,10 @@ class OpenQABot(ReviewBot.ReviewBot):
|
||||
elif binary.attrib['filename'] == 'updateinfo.xml':
|
||||
url = osc.core.makeurl(
|
||||
self.apiurl,
|
||||
('build', a.src_project, a.tgt_project.replace(':', '_'), arch, a.src_package, 'updateinfo.xml'))
|
||||
('build', a.src_project, a.tgt_project.replace(':', '_'),
|
||||
arch,
|
||||
a.src_package,
|
||||
'updateinfo.xml'))
|
||||
ui = ET.parse(osc.core.http_GET(url)).getroot()
|
||||
patch_id = ui.find('.//id').text
|
||||
|
||||
@ -432,10 +438,10 @@ class OpenQABot(ReviewBot.ReviewBot):
|
||||
try:
|
||||
ret = self.openqa.openqa_request('POST', 'isos', data=settings, retries=1)
|
||||
self.logger.info(pformat(ret))
|
||||
except JSONDecodeError, e:
|
||||
except JSONDecodeError as e:
|
||||
self.logger.error(e)
|
||||
# TODO: record error
|
||||
except openqa_exceptions.RequestError, e:
|
||||
except openqa_exceptions.RequestError as e:
|
||||
self.logger.error(e)
|
||||
|
||||
return None
|
||||
@ -449,7 +455,8 @@ class OpenQABot(ReviewBot.ReviewBot):
|
||||
for url in repos:
|
||||
url += '/repodata/repomd.xml'
|
||||
root = ET.parse(osc.core.http_GET(url)).getroot()
|
||||
cs = root.find('.//{http://linux.duke.edu/metadata/repo}data[@type="primary"]/{http://linux.duke.edu/metadata/repo}checksum')
|
||||
cs = root.find(
|
||||
'.//{http://linux.duke.edu/metadata/repo}data[@type="primary"]/{http://linux.duke.edu/metadata/repo}checksum')
|
||||
m.update(cs.text)
|
||||
return m.hexdigest()
|
||||
|
||||
@ -509,7 +516,7 @@ class OpenQABot(ReviewBot.ReviewBot):
|
||||
nr = int(build.split('-')[1])
|
||||
if nr > buildnr:
|
||||
buildnr = nr
|
||||
except:
|
||||
except BaseException:
|
||||
continue
|
||||
|
||||
buildnr = "%s-%d" % (today, buildnr + 1)
|
||||
@ -525,7 +532,7 @@ class OpenQABot(ReviewBot.ReviewBot):
|
||||
if not self.dryrun:
|
||||
try:
|
||||
self.openqa.openqa_request('POST', 'isos', data=s, retries=1)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.logger.debug(e)
|
||||
self.update_test_builds[prj] = buildnr
|
||||
|
||||
@ -701,12 +708,13 @@ class OpenQABot(ReviewBot.ReviewBot):
|
||||
# this is for humans to decide which incident broke the test repo
|
||||
jobs += self.request_get_openqa_jobs(req, incident=False, test_repo=True)
|
||||
if self.calculate_qa_status(jobs) == QA_INPROGRESS:
|
||||
self.logger.debug("incident tests for request %s are done, but need to wait for test repo", req.reqid)
|
||||
self.logger.debug(
|
||||
"incident tests for request %s are done, but need to wait for test repo", req.reqid)
|
||||
return
|
||||
groups = dict()
|
||||
for job in jobs:
|
||||
gl = "%s@%s" % (self.emd(job['group']), self.emd(job['settings']['FLAVOR']))
|
||||
if not gl in groups:
|
||||
if gl not in groups:
|
||||
groupurl = osc.core.makeurl(self.openqa.baseurl, ['tests', 'overview'],
|
||||
{'version': job['settings']['VERSION'],
|
||||
'groupid': job['group_id'],
|
||||
@ -777,7 +785,8 @@ class CommandLineInterface(ReviewBot.CommandLineInterface):
|
||||
def get_optparser(self):
|
||||
parser = ReviewBot.CommandLineInterface.get_optparser(self)
|
||||
parser.add_option("--force", action="store_true", help="recheck requests that are already considered done")
|
||||
parser.add_option("--no-comment", dest='comment', action="store_false", default=True, help="don't actually post comments to obs")
|
||||
parser.add_option("--no-comment", dest='comment', action="store_false",
|
||||
default=True, help="don't actually post comments to obs")
|
||||
parser.add_option("--openqa", metavar='HOST', help="openqa api host")
|
||||
return parser
|
||||
|
||||
@ -796,6 +805,7 @@ class CommandLineInterface(ReviewBot.CommandLineInterface):
|
||||
|
||||
return bot
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
requests_log = logging.getLogger("requests.packages.urllib3")
|
||||
requests_log.setLevel(logging.WARNING)
|
||||
|
Loading…
x
Reference in New Issue
Block a user