diff options
author | khilman <khilman@users.noreply.github.com> | 2018-09-13 11:25:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-13 11:25:40 -0700 |
commit | 55579b2a662bee819a2c531d3db99edd3f230212 (patch) | |
tree | 16cca6239ea73c061f0c831b21166e272e95826a | |
parent | 53cecb649a6afb33ab6e4309db03ee7b697282d7 (diff) | |
parent | fa9eb27201929ba157b2b57769982a13fd4e37d0 (diff) |
Merge pull request #46 from montjoie/nomaster
lavalab-gen.py: permit to have no master in boards.yaml
-rw-r--r-- | README.md | 2 | ||||
-rwxr-xr-x | lavalab-gen.py | 32 |
2 files changed, 23 insertions, 11 deletions
@@ -236,11 +236,13 @@ slaves: host: name name of the host running lava-slave-XX (default to "local") zmq_auth_key: optional path to a public ZMQ key zmq_auth_key_secret: optional path to a private ZMQ key + zmq_auth_master_key: optional path to the public master ZMQ key. This option is necessary only if no master node exists in boards.yaml. dispatcher_ip: the IP where the slave could be contacted. In lava-docker it is the host IP since docker proxify TFTP from host to the slave. remote_master: the name of the master to connect to remote_address: the FQDN or IP address of the master (if different from remote_master) remote_rpc_port: the port used by the LAVA RPC2 (default 80) remote_user: the user used for connecting to the master + remote_user_token: The remote_user's token. This option is necessary only if no master node exists in boards.yaml. Otherwise lavalab-gen.py will get from it. remote_proto: http(default) or https default_slave: Does this slave is the default slave where to add boards (default: lab-slave-0) export_ser2net: Do ser2net ports need to be available on host 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: |