reporters/swatbot: Improve swat_monitor handling

The property may be unset, avoid tracebacks if so.

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

View File

@ -64,7 +64,6 @@ class SwatBotURI(object):
"buildid": collection_build_id,
"targetname": build['builder']['name'],
"branch": build['properties']['branch_poky'][0],
"forswat": build['properties']['swat_monitor'][0],
}
}
}
@ -75,6 +74,10 @@ class SwatBotURI(object):
payload['data']['attributes']['reason'] = build['properties']['reason'][0]
if 'owner' in build['properties'] and build['properties']['owner'][0]:
payload['data']['attributes']['owner'] = build['properties']['owner'][0]
if 'swat_monitor' build['properties'] and build['properties']['swat_monitor'][0]:
payload['data']['attributes']['forswat'] = True
else:
payload['data']['attributes']['forswat'] = False
try:
req = self.client.post(url, json=payload, timeout=self.TIMEOUT, headers=self.headers)