update_psa():

if called without -m (without MAINTENANCE):
check for ISMAS updates 3 times. If no response by ISMAS, end update process with FAILURE (exit script)
if called with -m:
check for ISMAS updates 10 times. If no response by ISMAS, end update process with FAILURE (exit script)
This commit is contained in:
Gerhard Hoffmann 2023-06-29 13:38:41 +02:00
parent 1ecabe79ca
commit 0a428d8756

View File

@ -45,36 +45,48 @@ update_psa() {
check_sanity_of_repository
$INITIAL_CLONE && return 0
local ismas_requests=0
if [ "$MAINTENANCE" = "NO" ]; then
log_info "update_psa:${LINENO}: MAINTENANCE OFF. Checking for updates..."
log_info "${func}:${LINENO}: MAINTENANCE OFF. Checking for updates..."
# someone must have activated the WAIT-button in ISMAS.
# Request the status of this button in updates_available().
if ! updates_available; then
update_psa_false_alarm "update requested, but no WAIT state detected !!!"
while [ $ismas_requests -le 3 ]; do
ismas_requests=$(( $ismas_requests + 1 ))
updates_available && break
update_psa_false_alarm "update requested, but no WAIT state detected <$ismas_requests>"
done
if [ $ismas_requests -gt 3 ]; then
log_fatal "update_psa:${LINENO}: update requested, but no WAIT state detected !!!"
fi
else
# simulate an activated WAIT-button
log_info "${func}:${LINENO}: MAINTENANCE ON. Emulate ISMAS updates..."
# simulate an activated WAIT-button in ISMAS
set_updates_available
while :
do
while [ $ismas_requests -le 10 ]; do
sleep 5
updates_available && break
ismas_requests=$(( $ismas_requests + 1 ))
log_info "${func}:${LINENO}: updates_requested <$ismas_requests>"
done
if [ $ismas_requests -gt 10 ]; then
log_fatal "${func}:${LINENO}: NO ISMAS UPDATES AVAILABLE"
fi
fi
log_debug "$func:${LINENO}: fetch/merge updates..."
log_debug "$func:${LINENO}: before fetch/merge updates..."
# Fetch new updates (using git). but only when repository has already been
# cloned.
if ! fetch_customer_updates; then
log_error "$func:${LINENO}: fetch no data for $customer_id"\
"-> no files to update -> no psa update"
update_psa_false_alarm \
"update request, but no change in $CUSTOMER_REPOSITORY_PATH"
# TODO
log_fatal "$func:${LINENO}: fetch no data for $customer_id"\
"-> no files to update -> no psa update"
else
log_debug "$func:${LINENO}: after successful fetch_customer_repository..."
fi
update_psa_pull_customer_repository # message to ISMAS
}