@@ -165,7 +165,7 @@ def _push_items_from_raw(self, raw):
165165 erratum = attr .evolve (erratum , dest = sorted (erratum_dest ))
166166
167167 # Adjust push item destinations according to FTP paths from ET, if any.
168- items = self ._add_ftp_paths (items , erratum , raw . ftp_paths )
168+ items = self ._add_ftp_paths (items , erratum , raw )
169169
170170 items = items + self ._push_items_from_container_manifests (
171171 erratum , raw .advisory_cdn_docker_file_list
@@ -397,7 +397,9 @@ def _rpm_push_items_from_build(self, erratum, build_nvr, build_info):
397397
398398 return out
399399
400- def _add_ftp_paths (self , items , erratum , ftp_paths ):
400+ def _add_ftp_paths (self , items , erratum , raw ):
401+ ftp_paths = raw .ftp_paths
402+
401403 # ftp_paths structure is like this:
402404 #
403405 # {
@@ -462,13 +464,54 @@ def _add_ftp_paths(self, items, erratum, ftp_paths):
462464 # Other types of items are unaffected by ftp_paths.
463465 out .append (item )
464466
465- # If ET requests that modules should be pushed for any builds and we're
466- # missing a modulemd.src.txt for those, it's a fatal error.
467467 builds_missing_modules = sorted (builds_need_modules - builds_have_modules )
468- if builds_missing_modules :
468+ builds_missing_et = []
469+ builds_missing_koji = []
470+
471+ for nvr in builds_missing_modules :
472+ # If ET requests that modules should be pushed for any builds and we're
473+ # missing a modulemd.src.txt for those, there are two possible reasons for
474+ # that:
475+ #
476+ if not (raw .advisory_cdn_file_list .get (nvr ) or {}).get ("modules" ):
477+ #
478+ # (1) The same modules were not present in get_advisory_cdn_file_list.
479+ #
480+ builds_missing_et .append (nvr )
481+ else :
482+ #
483+ # (2) modulemd.src.txt is genuinely missing from koji.
484+ #
485+ builds_missing_koji .append (nvr )
486+
487+ if builds_missing_et :
488+ # Builds missing in ET are tolerated with just a warning.
489+ #
490+ # Although this probably *should* not happen, due to lack of any specification
491+ # for how these APIs are meant to work, it's a bit risky to treat it as an error.
492+ #
493+ # Note also that we *could* try to proceed here anyway, and now look up information
494+ # for this module from koji. The reason we don't do that is because the destination
495+ # for source modules (& RPMs) has been historically calculated by combining *both*
496+ # the FTP paths and repo IDs and passing them through alt-src config. If we only
497+ # have one of these sources of info and we proceed anyway, then we might push to
498+ # incorrect destinations while giving the false impression that everything is working
499+ # OK. Safer to not touch the item.
500+ #
501+ LOG .warning (
502+ "Erratum %s: ignoring module(s) from ftp_paths due to absence "
503+ "in cdn_file_list: %s" ,
504+ erratum .name ,
505+ ", " .join (builds_missing_et ),
506+ )
507+
508+ if builds_missing_koji :
509+ # Builds missing in koji are fatal as there is no reason this should happen; the
510+ # koji build might be malformed, incomplete or there have been some
511+ # backwards-incompatible changes in the structure of module builds.
469512 msg = "Erratum %s: missing modulemd sources on koji build(s): %s" % (
470513 erratum .name ,
471- ", " .join (builds_missing_modules ),
514+ ", " .join (builds_missing_koji ),
472515 )
473516 raise ValueError (msg )
474517
0 commit comments