Show More
@@ -808,10 +808,26 b' def ensure_windows_dev_ami(c: AWSConnect' | |||||
808 | ) |
|
808 | ) | |
809 |
|
809 | |||
810 | # Reboot so all updates are fully applied. |
|
810 | # Reboot so all updates are fully applied. | |
|
811 | # | |||
|
812 | # We don't use instance.reboot() here because it is asynchronous and | |||
|
813 | # we don't know when exactly the instance has rebooted. It could take | |||
|
814 | # a while to stop and we may start trying to interact with the instance | |||
|
815 | # before it has rebooted. | |||
811 | print('rebooting instance %s' % instance.id) |
|
816 | print('rebooting instance %s' % instance.id) | |
812 | ec2client.reboot_instances(InstanceIds=[instance.id]) |
|
817 | instance.stop() | |
|
818 | ec2client.get_waiter('instance_stopped').wait( | |||
|
819 | InstanceIds=[instance.id], | |||
|
820 | WaiterConfig={ | |||
|
821 | 'Delay': 5, | |||
|
822 | }) | |||
813 |
|
823 | |||
814 |
|
|
824 | instance.start() | |
|
825 | wait_for_ip_addresses([instance]) | |||
|
826 | ||||
|
827 | # There is a race condition here between the User Data PS script running | |||
|
828 | # and us connecting to WinRM. This can manifest as | |||
|
829 | # "AuthorizationManager check failed" failures during run_powershell(). | |||
|
830 | # TODO figure out a workaround. | |||
815 |
|
831 | |||
816 | print('waiting for Windows Remote Management to come back...') |
|
832 | print('waiting for Windows Remote Management to come back...') | |
817 | client = wait_for_winrm(instance.public_ip_address, 'Administrator', |
|
833 | client = wait_for_winrm(instance.public_ip_address, 'Administrator', |
General Comments 0
You need to be logged in to leave comments.
Login now