diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2018-09-12 15:20:07 +0200 |
---|---|---|
committer | Corentin LABBE <clabbe@baylibre.com> | 2018-09-13 20:24:39 +0200 |
commit | fa9eb27201929ba157b2b57769982a13fd4e37d0 (patch) | |
tree | 16cca6239ea73c061f0c831b21166e272e95826a /lavalab-gen.py | |
parent | 53cecb649a6afb33ab6e4309db03ee7b697282d7 (diff) |
lavalab-gen.py: permit to have no master in boards.yaml
This patch permits to have a boards.yaml without the master node.
In the same time, it permit to have also only a master node without
slave.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-x | lavalab-gen.py | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py index 634d742..517d0ad 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -86,9 +86,9 @@ def main(): zmq_auth_genlist = open("zmqauth/zmq_auth_gen/zmq_genlist", 'w') if "masters" not in workers: - print("Missing masters entry in boards.yaml") - sys.exit(1) - masters = workers["masters"] + masters = {} + else: + masters = workers["masters"] for master in masters: keywords_master = [ "name", "type", "host", "users", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret", "http_fqdn" ] for keyword in master: @@ -217,11 +217,11 @@ def main(): default_slave = "lab-slave-0" if "slaves" not in workers: - print("Missing slaves entry in boards.yaml") - sys.exit(1) - slaves = workers["slaves"] + slaves = {} + 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" ] + 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", "remote_user_token", "zmq_auth_master_key" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -285,7 +285,17 @@ def main(): remote_user = worker["remote_user"] # find master remote_token = "BAD" - for fm in workers["masters"]: + if "masters" in workers: + masters = workers["masters"] + else: + masters = {} + if "remote_user_token" in worker: + remote_token = worker["remote_user_token"] + if "zmq_auth_key" in worker: + shutil.copy(worker["zmq_auth_key"], "%s/zmq_auth/" % workerdir) + shutil.copy(worker["zmq_auth_key_secret"], "%s/zmq_auth/" % workerdir) + shutil.copy(worker["zmq_auth_master_key"], "%s/zmq_auth/" % workerdir) + for fm in masters: if fm["name"] == remote_master: for fuser in fm["users"]: if fuser["name"] == remote_user: @@ -326,9 +336,9 @@ def main(): os.chmod("%s/scripts/extra_actions" % workerdir, 0o755) if "boards" not in workers: - print("Missing boards") - sys.exit(1) - boards = workers["boards"] + boards = {} + else: + boards = workers["boards"] for board in boards: board_name = board["name"] if "slave" in board: |