From: Andrea Bolognani Date: Fri, 10 Sep 2021 13:35:49 +0000 (+0200) Subject: ci: Avoid use of magic constants X-Git-Tag: v7.8.0-rc1~211 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ba191f7e5b921cb8b7a70a857983856843129fb;p=thirdparty%2Flibvirt.git ci: Avoid use of magic constants The value 3 is the length of the "ci-" prefix, which is present in the items returned by get_registry_images() but not in those returned by get_dockerfiles(). Signed-off-by: Andrea Bolognani Reviewed-by: Beraldo Leal Reviewed-by: Michal Privoznik --- diff --git a/ci/util.py b/ci/util.py index d8be6631eb..f9f3c550db 100644 --- a/ci/util.py +++ b/ci/util.py @@ -68,10 +68,11 @@ def get_registry_stale_images(registry_uri: str, base_dir: str) -> Dict[str, int dockerfiles = get_dockerfiles(base_dir) images = get_registry_images(registry_uri) + name_prefix = "ci-" stale_images = {} for img in images: - if img["name"][3:] not in dockerfiles: + if img["name"][len(name_prefix):] not in dockerfiles: stale_images[img["name"]] = img["id"] return stale_images