From a150b3f5aa3c1d937361acb98d2f90a931603e22 Mon Sep 17 00:00:00 2001 From: Francesco De Martino Date: Mon, 14 Nov 2022 12:58:33 +0100 Subject: [PATCH] [integ-tests] Allow fetching of deprecated Centos 7 images Official Centos 7 AMIs listed here https://wiki.centos.org/Cloud/AWS have reached the 2 year EC2 default deprecation period. Allowing usage of deprecated AMIs for the build-image test while evaluating usage of marketplace AMIs Signed-off-by: Francesco De Martino --- tests/integration-tests/tests/common/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration-tests/tests/common/utils.py b/tests/integration-tests/tests/common/utils.py index df70e1e0ea..67f76431e7 100644 --- a/tests/integration-tests/tests/common/utils.py +++ b/tests/integration-tests/tests/common/utils.py @@ -30,7 +30,8 @@ OS_TO_OFFICIAL_AMI_NAME_OWNER_MAP = { "alinux2": {"name": "amzn2-ami-kernel-5.10-hvm-*.*.*.*-*-gp2", "owners": ["amazon"]}, - "centos7": {"name": "CentOS 7.*", "owners": ["125523088429"]}, + # TODO: use marketplace AMI if possible + "centos7": {"name": "CentOS 7.*", "owners": ["125523088429"], "includeDeprecated": True}, "ubuntu1804": { "name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-*-server-*", "owners": ["099720109477", "513442679011", "837727238323"], @@ -95,6 +96,7 @@ def retrieve_latest_ami(region, os, ami_type="official", architecture="x86_64", Filters=[{"Name": "name", "Values": [ami_name]}, {"Name": "architecture", "Values": [architecture]}] + additional_filters, Owners=AMI_TYPE_DICT.get(ami_type).get(os).get("owners"), + IncludeDeprecated=AMI_TYPE_DICT.get(ami_type).get(os).get("includeDeprecated", False), ) # Sort on Creation date Desc amis = sorted(response.get("Images", []), key=lambda x: x["CreationDate"], reverse=True)