From d2a68b82502a9952a05ff6fcf002e95415f2dad5 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: May 10 2017 14:16:22 +0000 Subject: Check also whether parent tag in inheritance tree is valid base module tag, and not only its parents. Signed-off-by: Jan Kaluza --- diff --git a/robosignatory/tagconsumer.py b/robosignatory/tagconsumer.py index f9d5835..6a693fb 100644 --- a/robosignatory/tagconsumer.py +++ b/robosignatory/tagconsumer.py @@ -111,8 +111,12 @@ class TagSignerConsumer(fedmsg.consumers.FedmsgConsumer): instance = self.koji_clients[koji_instance] if tag in instance['tags']: - self.dowork(build_nvr, build_id, tag, koji_instance, - skip_tagging=False) + if not instance['tags'][tag]: + log.info("No valid base module tag found in inheritance tree " + "for %s, skipping" % tag) + else: + self.dowork(build_nvr, build_id, tag, koji_instance, + skip_tagging=False) elif tag.startswith(self.module_prefixes): self.sign_modular_rpms(build_nvr, build_id, tag, koji_instance) @@ -199,13 +203,17 @@ class TagSignerConsumer(fedmsg.consumers.FedmsgConsumer): if info is None: return base_module_tag - # Try to recursively find all the parents of this parent tag. - maybe_tag = self.get_base_module_tag(session, info, parent_tags) - if not maybe_tag: - continue + # Check if parent_tag is valid base module tag. + maybe_tag = self.verify_base_module_tag(info) + if not maybe_tag or not maybe_tag['verified']: + # Try to recursively find all the parents of this parent tag. + maybe_tag = self.get_base_module_tag(session, info, parent_tags) + if not maybe_tag: + continue + + # Verify that the found tag is really a valid base module tag. + maybe_tag = self.verify_base_module_tag(maybe_tag) - # Verify that the found tag is really a valid base module tag. - maybe_tag = self.verify_base_module_tag(maybe_tag) if maybe_tag['verified']: # In case we have already found valid tag in the previous subtree # and right now we have another one, compare that their streams @@ -259,6 +267,11 @@ class TagSignerConsumer(fedmsg.consumers.FedmsgConsumer): base_module_tag = self.get_base_module_tag( session, info, parent_tags=parent_tags) + # Set the cache to None, so in case this module build does not have + # valid base module stream, we do not query PDC on every RPM, but just + # skip the tag altogether. + instance["tags"][tag] = None + if not base_module_tag: log.info("No base module tag found in inheritance tree for " "%s, skipping" % tag)