diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2018-10-08 11:40:10 +0200 |
---|---|---|
committer | Corentin LABBE <clabbe@baylibre.com> | 2018-10-15 16:29:33 +0200 |
commit | 593854791774531ec4fa7513be6d194a1ed067f4 (patch) | |
tree | 89dda94d8a99b6eb4cd4fd72d16f677c8dee6a20 | |
parent | f74ee88cb72165a8a825fa674a53372df169f4b6 (diff) |
lavalab-gen.py: Permit to customize exposed ports to a slave
This patch adds a way to choose a number of ports to be exposed from
host to slave.
-rw-r--r-- | README.md | 2 | ||||
-rwxr-xr-x | lavalab-gen.py | 5 |
2 files changed, 6 insertions, 1 deletions
@@ -247,6 +247,8 @@ slaves: 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 + expose_ports: Expose port p1 on the host to p2 on the worker slave. + - p1:p2 extra_actions: An optional list of action to do at end of the docker build - "apt-get install package" diff --git a/lavalab-gen.py b/lavalab-gen.py index 80c10e7..0e6ab5a 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -221,7 +221,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", "remote_user_token", "zmq_auth_master_key" ] + 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", "expose_ports" ] for keyword in slave: if not keyword in keywords_slaves: print("WARNING: unknown keyword %s" % keyword) @@ -325,6 +325,9 @@ def main(): if "dispatcher_ip" in worker: dockcomp["services"][worker_name]["environment"]["LAVA_DISPATCHER_IP"] = worker["dispatcher_ip"] + if "expose_ports" in worker: + for eports in worker["expose_ports"]: + dockcomp["services"][name]["ports"].append("%s" % eports) with open(dockcomposeymlpath, 'w') as f: yaml.dump(dockcomp, f) if "extra_actions" in worker: |