Skip to content

Commit

Permalink
Cache device-type list
Browse files Browse the repository at this point in the history
Permit the device-type loop to be faster by caching the device-type
list.
This also remove a crash when the call is inside the loop.
I dont find the reason of this crash, but it works now.

Signed-off-by: Corentin LABBE <[email protected]>
  • Loading branch information
montjoie committed Nov 17, 2023
1 parent abf118a commit d02c7bc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lava-master/entrypoint.d/01_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ if [ -e /root/lava-callback-tokens ];then
done
fi

lava-server manage device-types --no-color list > /tmp/device-types.list
if [ $? -ne 0 ];then
echo "ERROR: fail to get device-types"
exit 1
fi

# This directory is used for storing device-types already added
mkdir -p /root/.lavadocker/
if [ -e /root/device-types ];then
Expand All @@ -234,7 +240,7 @@ if [ -e /root/device-types ];then
cp $i /etc/lava-server/dispatcher-config/device-types/
chown lavaserver:lavaserver /etc/lava-server/dispatcher-config/device-types/$(basename $i)
devicetype=$(basename $i |sed 's,.jinja2,,')
lava-server manage device-types list | grep -q "[[:space:]]$devicetype[[:space:]]"
grep -q "[[:space:]]$devicetype[[:space:]]" /tmp/device-types.list
if [ $? -eq 0 ];then
echo "Skip already known $devicetype"
else
Expand Down

0 comments on commit d02c7bc

Please sign in to comment.