summaryrefslogtreecommitdiffstats
path: root/lavalab-gen.py
diff options
context:
space:
mode:
authorKevin Hilman <khilman@baylibre.com>2021-01-04 08:36:41 -0800
committerGitHub <noreply@github.com>2021-01-04 08:36:41 -0800
commit9b1f44982e0091d5e620d225b59ad5a4c0fc5aeb (patch)
tree075621a294fd16b0e177529af3073427aedd3c64 /lavalab-gen.py
parent7151f9ebc95495b0eb3beb6ee556737a5c6ed163 (diff)
parent7739038c60331b71add3d5183412e50a38bfa2f3 (diff)
Merge pull request #130 from montjoie/support-2020.09plus
Support 2020.09plus
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-xlavalab-gen.py31
1 files changed, 13 insertions, 18 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 66bc193..e4b3487 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -44,10 +44,6 @@ template_device_ser2net = string.Template("""
{% set connection_command = 'telnet 127.0.0.1 ${port}' %}
""")
-template_device_screen = string.Template("""
-{% set connection_command = 'ssh -o StrictHostKeyChecking=no -t root@127.0.0.1 "TERM=xterm screen -x ${board}"' %}
-""")
-
template_settings_conf = string.Template("""
{
"DEBUG": false,
@@ -97,6 +93,11 @@ def dockcomp_add_device(dockcomp, worker_name, devicemap):
return
dc_devices.append(devicemap)
+def dockcomp_add_cap(dockcomp, worker_name, cap):
+ if "cap_add" not in dockcomp["services"][worker_name]:
+ dockcomp["services"][worker_name]["cap_add"] = []
+ dockcomp["services"][worker_name]["cap_add"].append(cap)
+
def usage():
print("%s [boardsfile.yaml]" % sys.argv[0])
@@ -373,7 +374,8 @@ def main():
for slaveenv in worker["slaveenv"]:
slavename = slaveenv["name"]
envdir = "%s/env/%s" % (workerdir, slavename)
- os.mkdir(envdir)
+ if not os.path.isdir(envdir):
+ os.mkdir(envdir)
fenv = open("%s/env.yaml" % envdir, 'w')
fenv.write("overrides:\n")
for line in slaveenv["env"]:
@@ -523,7 +525,7 @@ def main():
else:
zmq_auth_genlist.write("%s/%s %s/%s\n" % (host, name, fm["host"], fm["name"]))
need_zmq_auth_gen = True
- if remote_token is "BAD":
+ if remote_token == "BAD":
print("Cannot find %s on %s" % (remote_user, remote_master))
sys.exit(1)
if "env" in slave:
@@ -549,7 +551,9 @@ def main():
else:
remote_proto = worker["remote_proto"]
remote_uri = "%s://%s:%s@%s:%s/RPC2" % (remote_proto, remote_user, remote_token, remote_address, remote_rpc_port)
+ remote_master_url = "%s://%s:%s" % (remote_proto, remote_address, remote_rpc_port)
dockcomp["services"][worker_name]["environment"]["LAVA_MASTER_URI"] = remote_uri
+ dockcomp["services"][worker_name]["environment"]["LAVA_MASTER_URL"] = remote_master_url
dockcomp["services"][worker_name]["environment"]["LAVA_MASTER_USER"] = remote_user
dockcomp["services"][worker_name]["environment"]["LAVA_MASTER_BASEURI"] = "%s://%s:%s/RPC2" % (remote_proto, remote_address, remote_rpc_port)
dockcomp["services"][worker_name]["environment"]["LAVA_MASTER_TOKEN"] = remote_token
@@ -568,8 +572,7 @@ def main():
dockcomp["services"][worker_name]["privileged"] = True
if "use_tap" in worker and worker["use_tap"]:
dockcomp_add_device(dockcomp, worker_name, "/dev/net/tun:/dev/net/tun")
- dockcomp["services"][worker_name]["cap_add"] = []
- dockcomp["services"][worker_name]["cap_add"].append("NET_ADMIN")
+ dockcomp_add_cap(dockcomp, worker_name, "NET_ADMIN")
if "host_healthcheck" in worker and worker["host_healthcheck"]:
dockcomp["services"]["healthcheck"] = {}
dockcomp["services"]["healthcheck"]["ports"] = ["8080:8080"]
@@ -728,17 +731,14 @@ def main():
dockcomp_add_device(dockcomp, worker_name, "/dev/%s:/dev/%s" % (board_name, board_name))
use_conmux = False
use_ser2net = False
- use_screen = False
- if "use_screen" in uart:
- use_screen = uart["use_screen"]
if "use_conmux" in uart:
use_conmux = uart["use_conmux"]
if "use_ser2net" in uart:
use_ser2net = uart["use_ser2net"]
- if (use_conmux and use_ser2net) or (use_conmux and use_screen) or (use_screen and use_ser2net):
+ if (use_conmux and use_ser2net):
print("ERROR: Only one uart handler must be configured")
sys.exit(1)
- if not use_conmux and not use_screen and not use_ser2net and not "connection_command" in board:
+ if not use_conmux and not use_ser2net and not "connection_command" in board:
use_ser2net = True
if use_conmux:
conmuxline = template_conmux.substitute(board=board_name, baud=baud)
@@ -761,11 +761,6 @@ def main():
fp = open("%s/ser2net.conf" % workerdir, "a")
fp.write(ser2net_line + " banner\n")
fp.close()
- if use_screen:
- device_line += template_device_screen.substitute(board=board_name)
- fp = open("%s/lava-screen.conf" % workerdir, "a")
- fp.write("%s\n" % board_name)
- fp.close()
if "connection_command" in board:
connection_command = board["connection_command"]
device_line += template_device_connection_command.substitute(connection_command=connection_command)