builder: attach koji init/import logs

De-serialize the koji init and import logs, required fields in the
ComposeLogs, and if non-empty, attach them to the task.
Update the tests to check for the presence of these logs.
This commit is contained in:
Christian Kellner 2020-11-17 14:45:50 +01:00
parent 68309e4b5a
commit c2b5bd7060
2 changed files with 17 additions and 3 deletions

View file

@ -177,13 +177,17 @@ class ComposeStatus:
class ComposeLogs:
def __init__(self, image_logs: List):
def __init__(self, image_logs: List, import_logs, init_logs):
self.image_logs = image_logs
self.koji_import_logs = import_logs
self.koji_init_logs = init_logs
@classmethod
def from_dict(cls, data: Dict):
image_logs = data["image_logs"]
return cls(image_logs)
import_logs = data["koji_import_logs"]
init_logs = data["koji_init_logs"]
return cls(image_logs, import_logs, init_logs)
class Client:
@ -314,6 +318,12 @@ class OSBuildImage(BaseTaskHandler):
self.logger.warning("Failed to fetch logs: %s", str(e))
return
if logs.koji_init_logs:
self.upload_json(logs.koji_init_logs, "koji-init.log")
if logs.koji_import_logs:
self.upload_json(logs.koji_import_logs, "koji-import.log")
ilogs = zip(logs.image_logs, ireqs)
for log, ireq in ilogs:
name = "%s-%s.log" % (ireq.architecture, ireq.image_type)