contrib/automation/hgautomation/aws.py
branchstable
changeset 42648 d80edcb0b30c
parent 42647 8804aa6c07a0
child 42697 3e3fb15bfeea
equal deleted inserted replaced
42647:8804aa6c07a0 42648:d80edcb0b30c
  1030         finally:
  1030         finally:
  1031             for instance in instances:
  1031             for instance in instances:
  1032                 instance.ssh_client.close()
  1032                 instance.ssh_client.close()
  1033 
  1033 
  1034 
  1034 
  1035 def ensure_windows_dev_ami(c: AWSConnection, prefix='hg-'):
  1035 def ensure_windows_dev_ami(c: AWSConnection, prefix='hg-',
       
  1036                            base_image_name=WINDOWS_BASE_IMAGE_NAME):
  1036     """Ensure Windows Development AMI is available and up-to-date.
  1037     """Ensure Windows Development AMI is available and up-to-date.
  1037 
  1038 
  1038     If necessary, a modern AMI will be built by starting a temporary EC2
  1039     If necessary, a modern AMI will be built by starting a temporary EC2
  1039     instance and bootstrapping it.
  1040     instance and bootstrapping it.
  1040 
  1041 
  1048     ec2resource = c.ec2resource
  1049     ec2resource = c.ec2resource
  1049     ssmclient = c.session.client('ssm')
  1050     ssmclient = c.session.client('ssm')
  1050 
  1051 
  1051     name = '%s%s' % (prefix, 'windows-dev')
  1052     name = '%s%s' % (prefix, 'windows-dev')
  1052 
  1053 
  1053     image = find_image(ec2resource, AMAZON_ACCOUNT_ID, WINDOWS_BASE_IMAGE_NAME)
  1054     image = find_image(ec2resource, AMAZON_ACCOUNT_ID, base_image_name)
  1054 
  1055 
  1055     config = {
  1056     config = {
  1056         'BlockDeviceMappings': [
  1057         'BlockDeviceMappings': [
  1057             {
  1058             {
  1058                 'DeviceName': '/dev/sda1',
  1059                 'DeviceName': '/dev/sda1',
  1101     fingerprint = resolve_fingerprint({
  1102     fingerprint = resolve_fingerprint({
  1102         'instance_config': config,
  1103         'instance_config': config,
  1103         'user_data': WINDOWS_USER_DATA,
  1104         'user_data': WINDOWS_USER_DATA,
  1104         'initial_bootstrap': WINDOWS_BOOTSTRAP_POWERSHELL,
  1105         'initial_bootstrap': WINDOWS_BOOTSTRAP_POWERSHELL,
  1105         'bootstrap_commands': commands,
  1106         'bootstrap_commands': commands,
       
  1107         'base_image_name': base_image_name,
  1106     })
  1108     })
  1107 
  1109 
  1108     existing_image = find_and_reconcile_image(ec2resource, name, fingerprint)
  1110     existing_image = find_and_reconcile_image(ec2resource, name, fingerprint)
  1109 
  1111 
  1110     if existing_image:
  1112     if existing_image: