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:
parent
e2d0f49610
commit
a1b03e2b80
2 changed files with 11 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue