From 5ec706b035b1213bb82ceabf5e7d160d8003b174 Mon Sep 17 00:00:00 2001 From: Corentin LABBE Date: Thu, 13 Sep 2018 14:02:09 +0200 Subject: Permit to add tags to devices This patch permits to add tags to device Signed-off-by: Corentin Labbe --- README.md | 3 +++ lava-slave/Dockerfile | 1 + lava-slave/scripts/setup.sh | 7 +++++++ lava-slave/tags/.empty | 0 lavalab-gen.py | 6 ++++++ 5 files changed, 17 insertions(+) create mode 100644 lava-slave/tags/.empty diff --git a/README.md b/README.md index 16db7b8..18334af 100644 --- a/README.md +++ b/README.md @@ -257,6 +257,9 @@ boards: uboot_macaddr: (Optional) the MAC address to set in uboot custom_option: (optional) All following strings will be directly append to devicefile - "set x=1" + tags: (optional) List of tag to set on this device + - tag1 + - tag2 # One of uart or connection_command must be choosen uart: idvendor: The VID of the UART (Formated as 0xXXXX) diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile index cbaafdc..d9ae68a 100644 --- a/lava-slave/Dockerfile +++ b/lava-slave/Dockerfile @@ -43,6 +43,7 @@ COPY scripts/retire.sh /usr/local/bin/ RUN chmod 755 /usr/local/bin/retire.sh COPY devices/ /root/devices/ +COPY tags/ /root/tags/ COPY scripts/extra_actions /root/ RUN if [ -x /root/extra_actions ] ; then /root/extra_actions ; fi diff --git a/lava-slave/scripts/setup.sh b/lava-slave/scripts/setup.sh index 7cff479..f281f6b 100755 --- a/lava-slave/scripts/setup.sh +++ b/lava-slave/scripts/setup.sh @@ -113,6 +113,13 @@ do lavacli $LAVACLIOPTS devices add --type $devicetype --worker $worker $devicename || exit $? lavacli $LAVACLIOPTS devices dict set $devicename /root/devices/$worker/$device || exit $? fi + if [ -e /root/tags/$devicename ];then + while read tag + do + echo "DEBUG: Add tag $tag to $devicename" + lavacli $LAVACLIOPTS devices tags add $devicename $tag || exit $? + done < /root/tags/$devicename + fi done done diff --git a/lava-slave/tags/.empty b/lava-slave/tags/.empty new file mode 100644 index 0000000..e69de29 diff --git a/lavalab-gen.py b/lavalab-gen.py index 517d0ad..80c10e7 100755 --- a/lavalab-gen.py +++ b/lavalab-gen.py @@ -456,6 +456,12 @@ def main(): if "fastboot_serial_number" in board: fserial = board["fastboot_serial_number"] device_line += "{%% set fastboot_serial_number = '%s' %%}" % fserial + if "tags" in board: + tagdir = "%s/tags/" % workerdir + ftag = open("%s/%s" % (tagdir, board_name), 'w') + for tag in board["tags"]: + ftag.write("%s\n" % tag) + ftag.close() if "custom_option" in board: for coption in board["custom_option"]: device_line += "{%% %s %%}\n" % coption -- cgit 1.2.3-korg