From e0bb2bb05421169d9b5a4e9f515eced1e3bf2c13 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 1 Feb 2018 11:56:34 +0100 Subject: Remove hardcoded devices for lava-slave The node devices was hardcoded for lava-slave. For example, lava-master could never have devices. Remove that hard-coding and made devices dynamic for any labname. --- lavalab-gen.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lavalab-gen.py b/lavalab-gen.py index f8a5d95..21e2c0b 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -51,10 +51,6 @@ def main(args): tdc = open("docker-compose.template", "r") dockcomp = yaml.load(tdc) tdc.close() - dc_devices = dockcomp["services"]["lava-slave"]["devices"] - if dc_devices is None: - dockcomp["services"]["lava-slave"]["devices"] = [] - dc_devices = dockcomp["services"]["lava-slave"]["devices"] # The slaves directory must exists if not os.path.isdir("lava-master/slaves/"): @@ -93,6 +89,11 @@ def main(args): else: devpath = b["uart"]["devpath"] udev_line += template_udev_devpath.substitute(board=board_name, devpath=devpath, idvendor=idvendor, idproduct=idproduct) + if dockcomp["services"][lab_name].has_key("devices"): + dc_devices = dockcomp["services"][lab_name]["devices"] + else: + dockcomp["services"][lab_name]["devices"] = [] + dc_devices = dockcomp["services"][lab_name]["devices"] dc_devices.append("/dev/%s:/dev/%s" % (board_name, board_name)) fp = open("lava-slave/conmux/%s.cf" % board_name, "w") fp.write(line) -- cgit 1.2.3-korg