reporters/swatbot: Handle missing logs correctly

For reasons unknown, logs may not always be reported, handle this
more gracefully so the error is still logged.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2021-01-22 10:40:57 +00:00
parent 1f07a1768f
commit dbdc805de0

View File

@ -184,11 +184,15 @@ class SwatBotURI(object):
urls = []
for l in logs:
urls.append('%s/steps/%s/logs/%s' % (build['url'], step_number, l['name']))
if urls:
urls = " ".join(urls)
else:
urls = ""
payload = {
'data': {
'type': 'StepFailure',
'attributes': {
"urls": " ".join(urls),
"urls": urls,
"status": s['results'],
"stepname": s['name'],
"stepnumber": s['number'],