Remove unused (but defaulted) args
Every time we call start_server, check is True. Every time we call check_server, we use the default timeout. Change-Id: Id38182f15bcbfbb145b57cee179a8fd47ec8e2b7
This commit is contained in:
parent
e56a1a550a
commit
6b0e9a3e24
@ -58,18 +58,16 @@ def get_server_number(ipport, ipport2server):
|
|||||||
return server, number
|
return server, number
|
||||||
|
|
||||||
|
|
||||||
def start_server(ipport, ipport2server, check=True):
|
def start_server(ipport, ipport2server):
|
||||||
server, number = get_server_number(ipport, ipport2server)
|
server, number = get_server_number(ipport, ipport2server)
|
||||||
err = Manager([server]).start(number=number, wait=False)
|
err = Manager([server]).start(number=number, wait=False)
|
||||||
if err:
|
if err:
|
||||||
raise Exception('unable to start %s' % (
|
raise Exception('unable to start %s' % (
|
||||||
server if not number else '%s%s' % (server, number)))
|
server if not number else '%s%s' % (server, number)))
|
||||||
if check:
|
return check_server(ipport, ipport2server)
|
||||||
return check_server(ipport, ipport2server)
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def check_server(ipport, ipport2server, timeout=CHECK_SERVER_TIMEOUT):
|
def check_server(ipport, ipport2server):
|
||||||
server = ipport2server[ipport]
|
server = ipport2server[ipport]
|
||||||
if server[:-1] in ('account', 'container', 'object'):
|
if server[:-1] in ('account', 'container', 'object'):
|
||||||
if int(server[-1]) > 4:
|
if int(server[-1]) > 4:
|
||||||
@ -79,7 +77,7 @@ def check_server(ipport, ipport2server, timeout=CHECK_SERVER_TIMEOUT):
|
|||||||
path += '/3'
|
path += '/3'
|
||||||
elif server[:-1] == 'object':
|
elif server[:-1] == 'object':
|
||||||
path += '/3/4'
|
path += '/3/4'
|
||||||
try_until = time() + timeout
|
try_until = time() + CHECK_SERVER_TIMEOUT
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
conn = HTTPConnection(*ipport)
|
conn = HTTPConnection(*ipport)
|
||||||
@ -95,11 +93,11 @@ def check_server(ipport, ipport2server, timeout=CHECK_SERVER_TIMEOUT):
|
|||||||
if time() > try_until:
|
if time() > try_until:
|
||||||
print(err)
|
print(err)
|
||||||
print('Giving up on %s:%s after %s seconds.' % (
|
print('Giving up on %s:%s after %s seconds.' % (
|
||||||
server, ipport, timeout))
|
server, ipport, CHECK_SERVER_TIMEOUT))
|
||||||
raise err
|
raise err
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
else:
|
else:
|
||||||
try_until = time() + timeout
|
try_until = time() + CHECK_SERVER_TIMEOUT
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
url, token = get_auth('http://%s:%d/auth/v1.0' % ipport,
|
url, token = get_auth('http://%s:%d/auth/v1.0' % ipport,
|
||||||
|
Loading…
Reference in New Issue
Block a user