summaryrefslogtreecommitdiffstats
path: root/lavalab-gen.py
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2019-04-25 17:20:52 +0200
committerCorentin LABBE <clabbe@baylibre.com>2019-05-03 11:05:17 +0200
commitc56647c31313fe9cbf6aff9ab1e5c6ef5faf14f2 (patch)
tree199b18996032cc1aececd4d2007d57ba85687464 /lavalab-gen.py
parentad91a66ca580976a929f1e07045fa52bf1633c2b (diff)
Permit to add extra devices in the slave
This patch permit to adds extra devices (like a USB relay) in the slave
Diffstat (limited to 'lavalab-gen.py')
-rwxr-xr-xlavalab-gen.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/lavalab-gen.py b/lavalab-gen.py
index 65e2560..366c141 100755
--- a/lavalab-gen.py
+++ b/lavalab-gen.py
@@ -281,7 +281,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", "env", "bind_dev", "loglevel", "use_nfs", "arch" ]
+ 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", "bind_dev", "loglevel", "use_nfs", "arch", "devices" ]
for keyword in slave:
if not keyword in keywords_slaves:
print("WARNING: unknown keyword %s" % keyword)
@@ -420,6 +420,22 @@ def main():
fp.write("\n")
fp.close()
os.chmod("%s/scripts/extra_actions" % workerdir, 0o755)
+
+ if "devices" in worker:
+ if not os.path.isdir("output/%s/udev" % host):
+ os.mkdir("output/%s/udev" % host)
+ for udev_dev in worker["devices"]:
+ udev_line = 'SUBSYSTEM=="tty", ATTRS{idVendor}=="%04x", ATTRS{idProduct}=="%04x",' % (udev_dev["idvendor"], udev_dev["idproduct"])
+ if "serial" in udev_dev:
+ udev_line += 'ATTRS{serial}=="%s", ' % udev_dev["serial"]
+ if "devpath" in udev_dev:
+ udev_line += 'ATTRS{devpath}=="%s", ' % udev_dev["devpath"]
+ udev_line += 'MODE="0664", OWNER="uucp", SYMLINK+="%s"\n' % udev_dev["name"]
+ fudev = open("output/%s/udev/99-lavaworker-udev.rules" % host, "a")
+ fudev.write(udev_line)
+ fudev.close()
+ if not "bind_dev" in slave:
+ dockcomp_add_device(dockcomp, worker_name, "/dev/%s:/dev/%s" % (udev_dev["name"], udev_dev["name"]))
use_nfs = False
if "use_nfs" in worker:
use_nfs = worker["use_nfs"]