From 882409e2a1639ffd20aaa257fae99419e2168857 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Feb 22 2019 06:02:49 +0000 Subject: Do not use Lightblue "deprecated" field. Use "release_categories" instead. The "deprecated" field in Lightblue is not used anymore and it is not filled correctly by COMET. Instead, there is new "Deprecated" release_category. See METAXOR-2215 for more info. We have never actually used "deprecated" option anywhere in Freshmaker code, because we always used the default False value to query only for non-deprecated images. In this commit, the "deprecated" argument is removed from Lightblue class completely. If we ever need to query for deprecated images, we need to use "Deprecated" release category. --- diff --git a/freshmaker/lightblue.py b/freshmaker/lightblue.py index a9ab65e..7988a46 100644 --- a/freshmaker/lightblue.py +++ b/freshmaker/lightblue.py @@ -674,16 +674,13 @@ class LightBlue(object): return images def _set_container_repository_filters( - self, request, published=True, deprecated=False, + self, request, published=True, release_category="Generally Available"): """ Sets the additional filters to containerRepository request - based on the self.published, self.deprecated and self.release_category - attributes. + based on the self.published, self.release_category attributes. :param bool published: whether to limit queries to published repositories - :param bool deprecated: set to True to limit results to deprecated - repositories :param str release_category: filter only repositories with specific release category (options: Deprecated, Generally Available, Beta, Tech Preview) """ @@ -694,13 +691,6 @@ class LightBlue(object): "rvalue": published }) - if deprecated is not None: - request["query"]["$and"].append({ - "field": "deprecated", - "op": "=", - "rvalue": deprecated - }) - if release_category: request["query"]["$and"].append({ "field": "release_categories.*", @@ -711,16 +701,13 @@ class LightBlue(object): return request def find_all_container_repositories( - self, published=True, deprecated=False, - release_category="Generally Available"): + self, published=True, release_category="Generally Available"): """ Returns dict with repository name as key and ContainerRepository as value. :param bool published: whether to limit queries to published repositories - :param bool deprecated: set to True to limit results to deprecated - repositories :param str release_category: filter only repositories with specific release category (options: Deprecated, Generally Available, Beta, Tech Preview) @@ -739,7 +726,7 @@ class LightBlue(object): ] } repo_request = self._set_container_repository_filters( - repo_request, published, deprecated, release_category) + repo_request, published, release_category) repositories = self.find_container_repositories(repo_request) return {r["repository"]: r for r in repositories} @@ -1215,8 +1202,7 @@ class LightBlue(object): def find_images_with_packages_from_content_set( self, srpm_nvrs, content_sets, filter_fnc=None, - published=True, deprecated=False, - release_category="Generally Available", + published=True, release_category="Generally Available", leaf_container_images=None): """Query lightblue and find containers which contain given package from one of content sets @@ -1232,8 +1218,6 @@ class LightBlue(object): Freshmaker configuration. :param bool published: whether to limit queries to published repositories - :param bool deprecated: set to True to limit results to deprecated - repositories :param str release_category: filter only repositories with specific release category (options: Deprecated, Generally Available, Beta, Tech Preview) :param list leaf_container_images: List of NVRs of leaf images to @@ -1247,8 +1231,7 @@ class LightBlue(object): the given image - can be used for comparisons if needed :rtype: list """ - repos = self.find_all_container_repositories( - published, deprecated, release_category) + repos = self.find_all_container_repositories(published, release_category) if not repos: return [] if not leaf_container_images: @@ -1507,7 +1490,7 @@ class LightBlue(object): return batches def find_images_to_rebuild( - self, srpm_nvrs, content_sets, published=True, deprecated=False, + self, srpm_nvrs, content_sets, published=True, release_category="Generally Available", filter_fnc=None, leaf_container_images=None): """ @@ -1524,8 +1507,6 @@ class LightBlue(object): when looking for the packages :param bool published: whether to limit queries to published repositories - :param bool deprecated: set to True to limit results to deprecated - repositories :param str release_category: filter only repositories with specific release category (options: Deprecated, Generally Available, Beta, Tech Preview) :param function filter_fnc: Function called as @@ -1540,7 +1521,7 @@ class LightBlue(object): is not respected when `leaf_container_images` are used. """ images = self.find_images_with_packages_from_content_set( - srpm_nvrs, content_sets, filter_fnc, published, deprecated, + srpm_nvrs, content_sets, filter_fnc, published, release_category, leaf_container_images=leaf_container_images) srpm_names = [koji.parse_NVR(srpm_nvr)["name"] for srpm_nvr in srpm_nvrs] diff --git a/tests/test_lightblue.py b/tests/test_lightblue.py index 5124152..8247e15 100644 --- a/tests/test_lightblue.py +++ b/tests/test_lightblue.py @@ -923,11 +923,6 @@ class TestQueryEntityFromLightBlue(helpers.FreshmakerTestCase): "rvalue": True }, { - "field": "deprecated", - "op": "=", - "rvalue": False - }, - { "field": "release_categories.*", "op": "=", "rvalue": "Generally Available"