From c9074391969cd66dca1cb48817ed37f6b4aaf670 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Nov 05 2018 09:56:51 +0000 Subject: Do not limit the LB query for `leaf_container_images` to published images only. Using the `leaf_container_images`, the user of LB class defines the list of NVRs of container images which should be found in LB and rebuilt later. Therefore it does not make sense to limit such list and return only published images, because it is the caller responsibility to find out if the image is published or not and filter it out if he needs it. --- diff --git a/freshmaker/lightblue.py b/freshmaker/lightblue.py index 9856eb6..fb4853e 100644 --- a/freshmaker/lightblue.py +++ b/freshmaker/lightblue.py @@ -1124,8 +1124,10 @@ class LightBlue(object): images = self.find_images_with_included_srpms( content_sets, srpm_names, repos, published) else: + # The `leaf_container_images` can contain unpublished container image, + # therefore set `published` to None. images = self.get_images_by_nvrs( - leaf_container_images, published, content_sets, srpm_names) + leaf_container_images, None, content_sets, srpm_names) # There can be multi-arch images which share the same # image['brew']['build']. Freshmaker is not interested in the image @@ -1391,7 +1393,8 @@ class LightBlue(object): Freshmaker configuration. :param list leaf_container_images: List of NVRs of leaf images to consider for the rebuild. If not set, all images found in - Lightblue will be considered for rebuild. + Lightblue will be considered for rebuild. Note that `published` + is not respected when `leaf_container_images` are used. """ images = self.find_images_with_packages_from_content_set( srpm_names, content_sets, filter_fnc, published, deprecated, diff --git a/tests/test_lightblue.py b/tests/test_lightblue.py index 9d8ca15..de1e8fe 100644 --- a/tests/test_lightblue.py +++ b/tests/test_lightblue.py @@ -1405,8 +1405,7 @@ class TestQueryEntityFromLightBlue(helpers.FreshmakerTestCase): {'field': 'brew.build', 'rvalue': 'bar', 'op': '='}]}, {'field': 'parsed_data.files.*.key', 'rvalue': 'buildfile', 'op': '='}, {'$or': [{'field': 'content_sets.*', 'rvalue': 'dummy-content-set', 'op': '='}]}, - {'$or': [{'field': 'rpm_manifest.*.rpms.*.srpm_name', 'rvalue': 'openssl', 'op': '='}]}, - {'field': 'repositories.*.published', 'rvalue': True, 'op': '='}]}, + {'$or': [{'field': 'rpm_manifest.*.rpms.*.srpm_name', 'rvalue': 'openssl', 'op': '='}]}]}, 'projection': [{'field': 'brew', 'include': True, 'recursive': True}, {'field': 'parsed_data.files', 'include': True, 'recursive': True}, {'field': 'parsed_data.layers.*', 'include': True, 'recursive': True},