summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-10-25 15:25:50 +0200
committerCorentin LABBE <clabbe@baylibre.com>2018-11-02 16:47:59 +0100
commit11552973aa27342aa132e289debd0f01d835b5f5 (patch)
tree92848b04fd2ab13b13579afd25d4ef9be43b0dd9
parent5957ee693f8cc7b07613da6c2c7da576d7039e2f (diff)
lavalab-gen.py: permit to set env settings on slave via the master node
Since some setup use distinct boards.yaml for master and slave, a way to set env settings for a slave via the master node is needed.
-rw-r--r--README.md5
-rwxr-xr-xlavalab-gen.py12
2 files changed, 16 insertions, 1 deletions
diff --git a/README.md b/README.md
index 35cbd49..8a236f5 100644
--- a/README.md
+++ b/README.md
@@ -237,6 +237,11 @@ masters:
- username: The LAVA user owning the token below. (This user should be created via users:)
token: The token for this callback
description: The description of this token. This string could be used with LAVA-CI.
+ slaveenv: A list of environment to pass to slave
+ - name: slavename The name of slave (mandatory)
+ env:
+ - line1 A list of line to set as environment
+ - line2
slaves:
- name: lab-slave-XX The name of the slave (where XX is a number)
host: name name of the host running lava-slave-XX (default to "local")
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 202ec99..5191f07 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -93,7 +93,7 @@ def main():
else:
masters = workers["masters"]
for master in masters:
- keywords_master = [ "name", "type", "host", "users", "groups", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret", "http_fqdn", "slave_keys" ]
+ keywords_master = [ "name", "type", "host", "users", "groups", "tokens", "webadmin_https", "persistent_db", "zmq_auth", "zmq_auth_key", "zmq_auth_key_secret", "http_fqdn", "slave_keys", "slaveenv" ]
for keyword in master:
if not keyword in keywords_master:
print("WARNING: unknown keyword %s" % keyword)
@@ -243,6 +243,16 @@ def main():
ftok.write("TOKEN=" + vtoken + "\n")
ftok.write("DESCRIPTION=\"%s\"" % description)
ftok.close()
+ if "slaveenv" in worker:
+ for slaveenv in worker["slaveenv"]:
+ slavename = slaveenv["name"]
+ envdir = "%s/env/%s" % (workerdir, slavename)
+ os.mkdir(envdir)
+ fenv = open("%s/env.yaml" % envdir, 'w')
+ fenv.write("overrides:")
+ for line in slaveenv["env"]:
+ fenv.write(" %s\n" % line)
+ fenv.close()
default_slave = "lab-slave-0"
if "slaves" not in workers: