diff options
author | Corentin LABBE <clabbe@baylibre.com> | 2018-02-01 11:56:34 +0100 |
---|---|---|
committer | Corentin LABBE <clabbe@baylibre.com> | 2018-02-14 10:29:23 +0100 |
commit | e0bb2bb05421169d9b5a4e9f515eced1e3bf2c13 (patch) | |
tree | 76ed5ef2fdd32d753f42615e445368bcfe67d71f | |
parent | ba1194d18f296c474dc5d1d85402cccae860128e (diff) |
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.
-rwxr-xr-x | lavalab-gen.py | 9 |
1 files 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) |