diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2018-10-25 15:15:29 +0200 |
---|---|---|
committer | Corentin LABBE <clabbe@baylibre.com> | 2018-11-02 16:47:06 +0100 |
commit | 5957ee693f8cc7b07613da6c2c7da576d7039e2f (patch) | |
tree | 95fe8c83df554b506a4d78dd85074b10b8acaa22 /lavalab-gen.py | |
parent | 4cc99509aae4b37f077dee15b8878cd5e52dbcd6 (diff) |
lavalab-gen.py: permit to set env settings on slave
This patch permits to add some env settings on slave.
The primary goal of this is to permits to add a proxy for a specific slave.
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-x | lavalab-gen.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py index 7061a72..202ec99 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -250,7 +250,7 @@ def main(): else: slaves = workers["slaves"] for slave in slaves: - keywords_slaves = [ "name", "host", "dispatcher_ip", "remote_user", "remote_master", "remote_address", "remote_rpc_port", "remote_proto", "extra_actions", "zmq_auth_key", "zmq_auth_key_secret", "default_slave", "export_ser2net", "expose_ser2net", "remote_user_token", "zmq_auth_master_key", "expose_ports" ] + keywords_slaves = [ "name", "host", "dispatcher_ip", "remote_user", "remote_master", "remote_address", "remote_rpc_port", "remote_proto", "extra_actions", "zmq_auth_key", "zmq_auth_key_secret", "default_slave", "export_ser2net", "expose_ser2net", "remote_user_token", "zmq_auth_master_key", "expose_ports", "env" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -297,6 +297,7 @@ def main(): worker = slave worker_name = name + slave_master = None #NOTE remote_master is on slave if not "remote_master" in worker: remote_master = "lava-master" @@ -326,6 +327,7 @@ def main(): shutil.copy(worker["zmq_auth_master_key"], "%s/zmq_auth/" % workerdir) for fm in masters: if fm["name"] == remote_master: + slave_master = fm for fuser in fm["users"]: if fuser["name"] == remote_user: remote_token = fuser["token"] @@ -345,6 +347,17 @@ def main(): if remote_token is "BAD": print("Cannot find %s on %s" % (remote_user, remote_master)) sys.exit(1) + if "env" in slave: + if not slave_master: + print("Cannot set env without master") + sys.exit(1) + envdir = "output/%s/%s/env/%s" % (slave_master["host"], slave_master["name"], name) + os.mkdir(envdir) + fenv = open("%s/env.yaml" % envdir, 'w') + fenv.write("overrides:") + for line in slave["env"]: + fenv.write(" %s\n" % line) + fenv.close() if not "remote_proto" in worker: remote_proto = "http" else: |