mirror of
https://github.com/certbot/certbot.git
synced 2026-07-30 17:54:25 +02:00
switch to wait_until_running (#8715)
This commit is contained in:
@@ -190,18 +190,16 @@ def block_until_ssh_open(ipstring, wait_time=10, timeout=120):
|
|||||||
t_elapsed += wait_time
|
t_elapsed += wait_time
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
def block_until_instance_ready(booting_instance, wait_time=5, extra_wait_time=20):
|
def block_until_instance_ready(booting_instance, extra_wait_time=20):
|
||||||
"Blocks booting_instance until AWS EC2 instance is ready to accept SSH connections"
|
"Blocks booting_instance until AWS EC2 instance is ready to accept SSH connections"
|
||||||
state = booting_instance.state['Name']
|
booting_instance.wait_until_running()
|
||||||
ip = booting_instance.public_ip_address
|
# The instance needs to be reloaded to update its local attributes. See
|
||||||
while state != 'running' or ip is None:
|
# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Instance.reload.
|
||||||
time.sleep(wait_time)
|
booting_instance.reload()
|
||||||
# The instance needs to be reloaded to update its local attributes. See
|
# After waiting for the instance to be running and reloading the instance
|
||||||
# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Instance.reload.
|
# state, we should have an IP address.
|
||||||
booting_instance.reload()
|
assert booting_instance.public_ip_address is not None
|
||||||
state = booting_instance.state['Name']
|
block_until_ssh_open(booting_instance.public_ip_address)
|
||||||
ip = booting_instance.public_ip_address
|
|
||||||
block_until_ssh_open(ip)
|
|
||||||
time.sleep(extra_wait_time)
|
time.sleep(extra_wait_time)
|
||||||
return booting_instance
|
return booting_instance
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user