1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 18:26:15 +01:00

Merge pull request #552 from lethliel/fix_unhandled_exception_on_empty_package

fix triggerreason on empty packages.
This commit is contained in:
Marco Strigl 2019-06-12 13:07:16 +02:00 committed by GitHub
commit 7df178b50b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5654,9 +5654,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print(apiurl, project, package, repository, arch)
xml = show_package_trigger_reason(apiurl, project, package, repository, arch)
root = ET.fromstring(xml)
reason = root.find('explain').text
triggertime = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(int(root.find('time').text)))
print("%s (at %s)" % (reason, triggertime))
if root.find('explain') is None:
reason = "No triggerreason found"
print(reason)
else:
reason = root.find('explain').text
triggertime = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(int(root.find('time').text)))
print("%s (at %s)" % (reason, triggertime))
if reason == "meta change":
print("changed keys:")
for package in root.findall('packagechange'):