summaryrefslogtreecommitdiffstats
path: root/lava-slave/scripts/setup.sh
diff options
context:
space:
mode:
authorCorentin LABBE <clabbe@baylibre.com>2018-08-01 16:45:51 +0200
committerCorentin LABBE <clabbe@baylibre.com>2018-08-08 09:16:36 +0200
commita686fc2f61637a8554c55444efc748eb29f63f83 (patch)
treeeb68647e300199195082de5ea1580f41fdea0f7b /lava-slave/scripts/setup.sh
parent81286fbd7afe8d4df7a2b2eaefe6787e8863cee3 (diff)
Do not change status for retired/maintenance re-added devices
When re-adding devices to a worker, setup.sh re-add them with UNKNOWN status. This patch prevent this for RETIRED/MAINTENANCE status and keep it.
Diffstat (limited to 'lava-slave/scripts/setup.sh')
-rwxr-xr-xlava-slave/scripts/setup.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/lava-slave/scripts/setup.sh b/lava-slave/scripts/setup.sh
index 0105fbe..e7992c0 100755
--- a/lava-slave/scripts/setup.sh
+++ b/lava-slave/scripts/setup.sh
@@ -90,7 +90,22 @@ do
echo "ERROR: $devicename already present on another worker"
exit 1
fi
- lavacli $LAVACLIOPTS devices update --worker $worker --health UNKNOWN $devicename || exit $?
+ DEVICE_HEALTH=$(grep "$devicename[[:space:]]" /tmp/devices.list | sed 's/.*,//')
+ case "$DEVICE_HEALTH" in
+ Retired)
+ echo "DEBUG: Keep $devicename state: $DEVICE_HEALTH"
+ DEVICE_HEALTH='RETIRED'
+ ;;
+ Maintenance)
+ echo "DEBUG: Keep $devicename state: $DEVICE_HEALTH"
+ DEVICE_HEALTH='MAINTENANCE'
+ ;;
+ *)
+ echo "DEBUG: Set $devicename state to UNKNOWN (from $DEVICE_HEALTH)"
+ DEVICE_HEALTH='UNKNOWN'
+ ;;
+ esac
+ lavacli $LAVACLIOPTS devices update --worker $worker --health $DEVICE_HEALTH $devicename || exit $?
# always reset the device dict in case of update of it
lavacli $LAVACLIOPTS devices dict set $devicename /root/devices/$worker/$device || exit $?
else