summaryrefslogtreecommitdiffstats
path: root/lava-slave
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-08-01 11:07:26 +0200
committerCorentin LABBE <clabbe@baylibre.com>2018-08-08 09:16:36 +0200
commit81286fbd7afe8d4df7a2b2eaefe6787e8863cee3 (patch)
tree72dc4b117b24f04b431f7bedd43f91a986c55eb1 /lava-slave
parente2a93eae5955f294d4e37b7b653fb6fd86d72a61 (diff)
Call lava-cli devices/device-types list once
Instead of calling devices/device-types list for each device, call them once.
Diffstat (limited to 'lava-slave')
-rwxr-xr-xlava-slave/scripts/setup.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/lava-slave/scripts/setup.sh b/lava-slave/scripts/setup.sh
index e696e57..0105fbe 100755
--- a/lava-slave/scripts/setup.sh
+++ b/lava-slave/scripts/setup.sh
@@ -40,6 +40,14 @@ if [ -e /root/device-types ];then
done
fi
+lavacli $LAVACLIOPTS device-types list > /tmp/device-types.list
+if [ $? -ne 0 ];then
+ exit 1
+fi
+lavacli $LAVACLIOPTS devices list -a > /tmp/devices.list
+if [ $? -ne 0 ];then
+ exit 1
+fi
for worker in $(ls /root/devices/)
do
lavacli $LAVACLIOPTS workers list |grep -q $worker
@@ -63,7 +71,7 @@ do
echo "Skip devicetype $devicetype"
else
echo "Add devicetype $devicetype"
- lavacli $LAVACLIOPTS device-types list | grep -q "$devicetype[[:space:]]"
+ grep -q "$devicetype[[:space:]]" /tmp/device-types.list
if [ $? -eq 0 ];then
echo "Skip devicetype $devicetype"
else
@@ -72,7 +80,7 @@ do
touch /root/.lavadocker/devicetype-$devicetype
fi
echo "Add device $devicename on $worker"
- lavacli $LAVACLIOPTS devices list -a | grep -q $devicename
+ grep -q "$devicename[[:space:]]" /tmp/devices.list
if [ $? -eq 0 ];then
echo "$devicename already present"
#verify if present on another worker