builder: better and unified result value

When returning the result from the task handler function, return
a more complete and structured object in all cases. The name of
the sub-object is named after the service the item belongs to;
specifically composer is used for what belongs to (osbuild)-composer.
This commit is contained in:
Christian Kellner 2020-09-18 14:20:53 +02:00
parent e2d0f49610
commit a1b03e2b80
2 changed files with 11 additions and 10 deletions

View file

@ -313,17 +313,18 @@ class OSBuildImage(BaseTaskHandler):
self.logger.debug("Waiting for comose to finish")
status = client.wait_for_compose(cid)
if not status.is_success:
self.logger.error("Compose failed: %s", str(status))
return {
'koji_builds': []
}
return {
'koji_builds': [bid],
'composer_id': cid,
'build': bid,
result = {
"status": status.status,
"composer": {
"server": self.composer_url,
"id": cid
},
"koji": {
"build": bid
}
}
return result
# Stand alone osbuild composer API client executable

View file

@ -346,7 +346,7 @@ class TestBuilderPlugin(PluginTest):
res = handler.handler(*args)
assert res, "invalid compose result"
compose_id = res["composer_id"]
compose_id = res["composer"]["id"]
compose = composer.composes.get(compose_id)
self.assertIsNotNone(compose)