osbuild: tweak build() to be mypy clean

This commit tweaks build() to be mypy clean without the need to
call assert. This drops the map() and instead we use the existing
dict-like access of the manifest to get the pipeline. In practise
this should not happen but lets be prepared.

Note that a small tweak for the error is needed to make it clear
what is happening.

Thanks to Simon for raising this.
This commit is contained in:
Michael Vogt 2025-01-13 17:04:56 +01:00 committed by Achilleas Koutsou
parent d6aca23709
commit 154abafae8

View file

@ -518,8 +518,8 @@ class Manifest:
"""
results = {"success": True}
for pl in map(self.get, pipelines):
assert pl is not None
for name_or_id in pipelines:
pl = self[name_or_id]
res = pl.run(store, monitor, libdir, debug_break, stage_timeout)
results[pl.id] = res
if not res["success"]:
@ -569,7 +569,7 @@ class Manifest:
pl = self.get(name_or_id)
if pl:
return pl
raise KeyError(f"'{name_or_id}' not found")
raise KeyError(f"'{name_or_id}' not found in manifest pipelines: {list(self.pipelines.keys())}")
def __iter__(self) -> Iterator[Pipeline]:
return iter(self.pipelines.values())