def flush(self, gameservers, command, table=None, path=None):
locate_gameservers = self.game_pj.transform(gameservers)
ips = locate_gameservers.keys()
def _flush(gameserver, http_port):
base_url = 'http://127.0.0.1:{}/root/gateway.action'.format(http_port)
real_url = '{}?command={}'.format(base_url, command)
if table is not None:
real_url += '&tableName={}'.format(table)
if path is not None:
real_url += '&path={}'.format(path)
return run('curl "{}"'.format(real_url))
def _flush_task():
if path is not None:
download_from_resource(self.game, path)
ret = {}
for gameserver in locate_gameservers[env.host_string]:
print('Working on {}...'.format(gameserver))
http_port = get_http_port(gameserver)
result = _flush(gameserver, http_port)
_result = result.lower()
success_tags = ['succ', 'success']
if any(each in _result for each in success_tags):
ret[gameserver] = (True, result)
else:
ret[gameserver] = (False, result)
return ret
result = execute(_flush_task, hosts=ips)
total = {}
for each_result in result:
for each_gameserver in result[each_result]:
total[each_gameserver] = result[each_result][each_gameserver]
return total
评论列表
文章目录