Catch the issue when PDC does not contain RPMs, but the module definition says there should be some.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
Jan Kaluza 2017-10-19 13:28:13 +02:00
parent 6208dae869
commit 8951e90882
2 changed files with 14 additions and 3 deletions

View File

@ -189,9 +189,12 @@ def create_variant_repo(compose, arch, variant, pkg_type):
# Create copy of architecture specific mmd to filter out packages
# which are not part of this particular repo.
repo_mmd = copy.deepcopy(mmd)
repo_mmd["data"]["artifacts"]["rpms"] = [
rpm_nevra for rpm_nevra in repo_mmd["data"]["artifacts"]["rpms"]
if rpm_nevra in rpm_nevras]
# Modules without RPMs are also valid.
if ("artifacts" in repo_mmd["data"] and
"rpms" in repo_mmd["data"]["artifacts"]):
repo_mmd["data"]["artifacts"]["rpms"] = [
rpm_nevra for rpm_nevra in repo_mmd["data"]["artifacts"]["rpms"]
if rpm_nevra in rpm_nevras]
modules.append(repo_mmd)
with temp_dir() as tmp_dir:

View File

@ -194,6 +194,14 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event_id):
mmd = modulemd.ModuleMetadata()
mmd.loads(pdc_module["modulemd"])
# Catch the issue when PDC does not contain RPMs, but
# the module definition says there should be some.
if not pdc_module["rpms"] and mmd.components.rpms:
raise ValueError(
"Module %s does not have any rpms in 'rpms' PDC field,"
"but according to modulemd, there should be some."
% pdc_module["variant_uid"])
# Add RPMs from PDC response to modulemd, so we can track
# what RPM is in which module later in gather phase.
for rpm_nevra in pdc_module["rpms"]: