From 5a1c0a8ab2be262d760eca40a31e040b489ff274 Mon Sep 17 00:00:00 2001 From: Giulia Naponiello Date: Feb 14 2020 15:56:51 +0000 Subject: Don't limit images research to published images The get_images_by_nvrs method returns only published images, but the parent image of a published images doesn't need to be published in all cases. Signed-off-by: Giulia Naponiello --- diff --git a/freshmaker/lightblue.py b/freshmaker/lightblue.py index 362460f..d42d17a 100644 --- a/freshmaker/lightblue.py +++ b/freshmaker/lightblue.py @@ -1249,7 +1249,7 @@ class LightBlue(object): # We've reached the base image, stop recursion if not parent_brew_build: return children - parent_image = self.get_images_by_nvrs([parent_brew_build], srpm_names=[srpm_name]) + parent_image = self.get_images_by_nvrs([parent_brew_build], srpm_names=[srpm_name], published=None) if parent_image: parent_image = parent_image[0] @@ -1264,12 +1264,13 @@ class LightBlue(object): # the package so we know against which image it has been # built. # Let's try first with the "parent_brew_build" field. - parent = self.get_images_by_nvrs([parent_brew_build]) + parent = self.get_images_by_nvrs([parent_brew_build], published=None) if parent: parent = parent[0] parent.resolve(self, images) else: - err = "Couldn't find parent image. Lightblue data is probably incomplete" + err = "Couldn't find parent image %s. Lightblue data is probably incomplete" % ( + parent_brew_build) log.error(err) if not images[-1]['error']: images[-1]['error'] = err diff --git a/tests/test_lightblue.py b/tests/test_lightblue.py index c9eed04..5b48ade 100644 --- a/tests/test_lightblue.py +++ b/tests/test_lightblue.py @@ -1619,7 +1619,9 @@ class TestQueryEntityFromLightBlue(helpers.FreshmakerTestCase): self.assertEqual(ret[0]["brew"]["package"], "package-name-1") self.assertEqual(set(ret[0]["content_sets"]), set(["dummy-content-set-1", "dummy-content-set-2"])) - self.assertEqual(ret[-1]['error'], "Couldn't find parent image. Lightblue data is probably incomplete") + self.assertEqual(ret[-1]['error'], ( + "Couldn't find parent image some-original-nvr-7.6-252.1561619826. " + "Lightblue data is probably incomplete")) @patch("freshmaker.lightblue.ContainerImage.resolve_published") @patch("freshmaker.lightblue.LightBlue.get_images_by_nvrs")