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 | |
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.
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | lava-master/Dockerfile | 6 | ||||
-rw-r--r-- | lava-master/env/.empty | 0 | ||||
-rwxr-xr-x | lavalab-gen.py | 15 |
4 files changed, 25 insertions, 6 deletions
@@ -141,7 +141,6 @@ beagleboneblack, with FTDI (serial 1234567), connected to port 5 of an ACME The basic setup is composed of a host which runs the following docker images and DUT to be tested.<br/> * lava-master: run lava-server along with the web interface * lava-slave: run lava-dispatcher, the compoment which sends jobs to DUTs -* squid: an HTTP proxy for caching downloaded contents (kernel/dtb/rootfs) (Work in progress) The host and DUTs must share a common LAN.<br/> The host IP on this LAN must be set as dispatcher_ip in boards.yaml.<br/> @@ -257,6 +256,9 @@ slaves: - p1:p2 extra_actions: An optional list of action to do at end of the docker build - "apt-get install package" + env: + - line1 A list of line to set as environment (See /etc/lava-server/env.yaml for examples) + - line2 boards: - name: devicename Each board must be named by their device-type as "device-type-XX" (where XX is a number) @@ -392,3 +394,9 @@ There are two way to add custom devices types. If you have a brand new device-type, it is the simpliest way. * Copy a patch addding/modifying a device-type in lava-master/device-types-patch/ If you are modifying an already present (upstream) device-type, it is the best way. + +## How to made LAVA slave use a proxy ? +Add env to a slave like: +slave: + env: + - "http_proxy: http://dns:port" diff --git a/lava-master/Dockerfile b/lava-master/Dockerfile index 668c41f..fb28bc9 100644 --- a/lava-master/Dockerfile +++ b/lava-master/Dockerfile @@ -16,10 +16,6 @@ COPY groups/ /root/lava-groups/ COPY tokens/ /root/lava-callback-tokens/ COPY scripts/setup.sh / -#uncomment if you want to use squid -# warning the address used must be network accessible by all slave -#RUN sed -i 's,^.*http_proxy:.*, http_proxy: http://squid:3128,' /etc/lava-server/env.yaml - COPY settings.conf /etc/lava-server/ COPY device-types-patch/ /root/device-types-patch/ @@ -32,6 +28,8 @@ COPY zmq_auth/ /etc/lava-dispatcher/certificates.d/ COPY lava_http_fqdn /root/ +COPY env/ /etc/lava-server/dispatcher.d/ + EXPOSE 69/udp 80 3079 5555 5556 CMD /start.sh && while [ true ];do sleep 365d; done diff --git a/lava-master/env/.empty b/lava-master/env/.empty new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lava-master/env/.empty 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: |