I have been running a script in "local.sh" on some of our hosts that does several things, amongst which is a task to bring a host out of maintenance mode.
We have been using this script for some years, starting at a time when we were using vSphere 6.5.
We are now on 6.7u2 and on one of our systems the script has started playing up.
Especially this bit:
MaintenanceModeStatus=$(esxcli system maintenanceMode get)
case $MaintenanceModeStatus in
Enabled)
logger -s "AUTO-START : Exiting Maintenance Mode"
vim-cmd hostsvc/maintenance_mode_exit
if [ $? -ne 0 ]
then
logger -s "AUTO-START : Maintenance Mode exit failed"
fi
;;
Disabled)
logger -s "AUTO-START : Already out of Maintenance Mode"
;;
*)
logger -s "AUTO-START : Invalid MaintenanceMode status - $MaintenanceModeStatus"
esac
We have started seeing log entries for an "Invalid MaintenanceMode status" appearing for both hosts that use the script on one of the systems.
$MaintenanceModeStatus is coming back as "Connection error".
Putting a sleep delay before this section of the script seems to help, but we would like to understand why.
When "local.sh" is run, is possibly the case that not all services in VCSA are fully ready, and calls to get information may come back invalid, empty or unexpected values?