1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-15 18:16:13 +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,6 +5654,10 @@ 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)
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))