def wait_for_server(server, port):
 print 'Checking server {server} on port {port}'.format(server=server, port=port)
 if tasks.environment.dry_run:
  return True
 attempts = 0
 server_ok = False
 while (attempts < 30):
  try:
   connection = httplib.HTTPConnection(server, port, timeout=10)
   connection.request('GET', '/')
   response = connection.getresponse()
   if (int(response.status) == 200):
    server_ok = True
    break
  except:
   pass
  attempts += 1
  time.sleep(1)
 return server_ok

def wait_for_server ( server , port ) : print 'Checking server {server} on port {port}' . format ( server = server , port = port ) if tasks . environment . dry_run : return True attempts = 0 server_ok = False while ( attempts < 30 ) : try : connection = httplib . HTTPConnection ( server , port , timeout = 10 ) connection . request ( 'GET' , '/' ) response = connection . getresponse ( ) if ( int ( response . status ) == 200 ) : server_ok = True break except : pass attempts += 1 time . sleep ( 1 ) return server_ok
wait for a server to respond with status 200 .