Show More
@@ -59,7 +59,7 b" DEBIAN_ACCOUNT_ID_2 = '136693071363'" | |||
|
59 | 59 | UBUNTU_ACCOUNT_ID = '099720109477' |
|
60 | 60 | |
|
61 | 61 | |
|
62 |
WINDOWS_BASE_IMAGE_NAME = 'Windows_Server-2019-English-Full-Base- |
|
|
62 | WINDOWS_BASE_IMAGE_NAME = 'Windows_Server-2019-English-Full-Base-*' | |
|
63 | 63 | |
|
64 | 64 | |
|
65 | 65 | KEY_PAIRS = { |
@@ -464,7 +464,7 b' def ensure_iam_state(iamclient, iamresou' | |||
|
464 | 464 | profile.add_role(RoleName=role) |
|
465 | 465 | |
|
466 | 466 | |
|
467 | def find_image(ec2resource, owner_id, name): | |
|
467 | def find_image(ec2resource, owner_id, name, reverse_sort_field=None): | |
|
468 | 468 | """Find an AMI by its owner ID and name.""" |
|
469 | 469 | |
|
470 | 470 | images = ec2resource.images.filter( |
@@ -476,6 +476,13 b' def find_image(ec2resource, owner_id, na' | |||
|
476 | 476 | ] |
|
477 | 477 | ) |
|
478 | 478 | |
|
479 | if reverse_sort_field: | |
|
480 | images = sorted( | |
|
481 | images, | |
|
482 | key=lambda image: getattr(image, reverse_sort_field), | |
|
483 | reverse=True, | |
|
484 | ) | |
|
485 | ||
|
479 | 486 | for image in images: |
|
480 | 487 | return image |
|
481 | 488 | |
@@ -1059,7 +1066,7 b' def temporary_linux_dev_instances(' | |||
|
1059 | 1066 | |
|
1060 | 1067 | |
|
1061 | 1068 | def ensure_windows_dev_ami( |
|
1062 | c: AWSConnection, prefix='hg-', base_image_name=WINDOWS_BASE_IMAGE_NAME | |
|
1069 | c: AWSConnection, prefix='hg-', base_image_name=WINDOWS_BASE_IMAGE_NAME, | |
|
1063 | 1070 | ): |
|
1064 | 1071 | """Ensure Windows Development AMI is available and up-to-date. |
|
1065 | 1072 | |
@@ -1078,7 +1085,12 b' def ensure_windows_dev_ami(' | |||
|
1078 | 1085 | |
|
1079 | 1086 | name = '%s%s' % (prefix, 'windows-dev') |
|
1080 | 1087 | |
|
1081 | image = find_image(ec2resource, AMAZON_ACCOUNT_ID, base_image_name) | |
|
1088 | image = find_image( | |
|
1089 | ec2resource, | |
|
1090 | AMAZON_ACCOUNT_ID, | |
|
1091 | base_image_name, | |
|
1092 | reverse_sort_field="name", | |
|
1093 | ) | |
|
1082 | 1094 | |
|
1083 | 1095 | config = { |
|
1084 | 1096 | 'BlockDeviceMappings': [ |
General Comments 0
You need to be logged in to leave comments.
Login now