Skip to content

Commit 9308b59

Browse files
committed
[integ-tests] Backport Allow fetching of deprecated Centos 7 images
Backport #4536 Signed-off-by: chenwany <[email protected]>
1 parent dcef719 commit 9308b59

File tree

1 file changed

+3
-1
lines changed
  • tests/integration-tests/tests/common

1 file changed

+3
-1
lines changed

tests/integration-tests/tests/common/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929

3030
OS_TO_OFFICIAL_AMI_NAME_OWNER_MAP = {
3131
"alinux2": {"name": "amzn2-ami-hvm-*.*.*.*-*-gp2", "owners": ["amazon"]},
32-
"centos7": {"name": "CentOS 7.*", "owners": ["125523088429"]},
32+
# TODO: use marketplace AMI if possible
33+
"centos7": {"name": "CentOS 7.*", "owners": ["125523088429"], "includeDeprecated": True},
3334
"ubuntu1804": {
3435
"name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-*-server-*",
3536
"owners": ["099720109477", "513442679011", "837727238323"],
@@ -74,6 +75,7 @@ def retrieve_latest_ami(region, os, ami_type="official", architecture="x86_64"):
7475
response = boto3.client("ec2", region_name=region).describe_images(
7576
Filters=[{"Name": "name", "Values": [ami_name]}, {"Name": "architecture", "Values": [architecture]}],
7677
Owners=AMI_TYPE_DICT.get(ami_type).get(os).get("owners"),
78+
IncludeDeprecated=AMI_TYPE_DICT.get(ami_type).get(os).get("includeDeprecated", False),
7779
)
7880
# Sort on Creation date Desc
7981
amis = sorted(response.get("Images", []), key=lambda x: x["CreationDate"], reverse=True)

0 commit comments

Comments
 (0)