Change env name + fix python casting

This commit is contained in:
Quentin 2021-12-13 10:53:42 +01:00
parent 1607ceaf5c
commit 9719f4b294
Signed by untrusted user: quentin
GPG key ID: A98E9B769E4FF428
2 changed files with 4 additions and 4 deletions

View file

@ -19,7 +19,7 @@ def leader():
sock.bind(UNIX_SOCK) sock.bind(UNIX_SOCK)
sock.listen() sock.listen()
n_serv = os.environ['SIZE'] n_serv = int(os.environ['SERVER_COUNT'])
fl = [ co for co, addr in [ sock.accept() for i in range(n_serv - 1) ]] fl = [ co for co, addr in [ sock.accept() for i in range(n_serv - 1) ]]
identities = [ json.loads(co.makefile().readline()) for co in fl ] + [ { "ip": os.environ['IP'], "path": make_data() } ] identities = [ json.loads(co.makefile().readline()) for co in fl ] + [ { "ip": os.environ['IP'], "path": make_data() } ]
@ -52,7 +52,7 @@ def make_data():
return data_path return data_path
def run_minio(identities): def run_minio(identities):
cmd = f"minio server --console-address ':9001' --address [{os.environ['IP']}]:9000" cmd = f"minio server --console-address ':9001' --address ':9000'"
for ident in identities: for ident in identities:
cmd += f" http://[{ident['ip']}]:9000{ident['path']}" cmd += f" http://[{ident['ip']}]:9000{ident['path']}"
cmd += f" > {os.path.join(STORAGE_PATH, 'minio'+os.environ['ID']+'.log')} 2>&1" cmd += f" > {os.path.join(STORAGE_PATH, 'minio'+os.environ['ID']+'.log')} 2>&1"

4
mknet
View file

@ -321,7 +321,7 @@ def runall(cmd):
env["HOST"] = server.name env["HOST"] = server.name
env["IP"] = str(server.ip) env["IP"] = str(server.ip)
env["ID"] = str(number) env["ID"] = str(number)
env["SIZE"] = str(len(config['servers'])) env["SERVER_COUNT"] = str(len(config['servers']))
name = f'testnet-{zone.name}-{server.name}' name = f'testnet-{zone.name}-{server.name}'
net.ns.run(name, cmd, env) net.ns.run(name, cmd, env)
number +=1 number +=1
@ -331,7 +331,7 @@ def runall(cmd):
env["HOST"] = zone.name env["HOST"] = zone.name
env["IP"] = str(zone.ip) env["IP"] = str(zone.ip)
env["ID"] = str(number) env["ID"] = str(number)
env["SIZE"] = str(len(config['servers'])) env["SERVER_COUNT"] = str(len(config['servers']))
name = f'testnet-{zone.name}-{zone.name}' name = f'testnet-{zone.name}-{zone.name}'
net.ns.run(name, cmd, env) net.ns.run(name, cmd, env)
first = False first = False