mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Instead of waiting 45s, test port 22 conns. until all work
This commit is contained in:
parent
2ef9bedfef
commit
653a6a231c
@ -14,6 +14,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import socket
|
||||||
import argparse
|
import argparse
|
||||||
import botocore
|
import botocore
|
||||||
import boto3
|
import boto3
|
||||||
@ -192,8 +193,23 @@ with open('hostlist.py', 'w') as f:
|
|||||||
f.write('\n')
|
f.write('\n')
|
||||||
f.write('public_dns_names = {}\n'.format(public_dns_names))
|
f.write('public_dns_names = {}\n'.format(public_dns_names))
|
||||||
|
|
||||||
# Wait
|
|
||||||
wait_time = 45
|
# For each node in the cluster, check port 22 (ssh) until it's reachable
|
||||||
print('Waiting {} seconds to make sure all instances are ready...'.
|
for public_dns_name in public_dns_names:
|
||||||
format(wait_time))
|
# Create an INET, STREAMing socket
|
||||||
time.sleep(wait_time)
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
print('Attempting to connect to {} on port 22 (ssh)...'.
|
||||||
|
format(public_dns_name))
|
||||||
|
unreachable = True
|
||||||
|
while unreachable:
|
||||||
|
try:
|
||||||
|
# Open a TCP connection to the remote node on port 22
|
||||||
|
s.connect((public_dns_name, 22))
|
||||||
|
print(' Port 22 is reachable!')
|
||||||
|
s.shutdown(socket.SHUT_WR)
|
||||||
|
s.close()
|
||||||
|
unreachable = False
|
||||||
|
except socket.error as e:
|
||||||
|
print(' Socket error: {}'.format(e))
|
||||||
|
print(' Trying again in 3 seconds')
|
||||||
|
time.sleep(3.0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user