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:
parent
1ecabe79ca
commit
0a428d8756
@ -45,34 +45,46 @@ update_psa() {
|
|||||||
check_sanity_of_repository
|
check_sanity_of_repository
|
||||||
$INITIAL_CLONE && return 0
|
$INITIAL_CLONE && return 0
|
||||||
|
|
||||||
|
local ismas_requests=0
|
||||||
|
|
||||||
if [ "$MAINTENANCE" = "NO" ]; then
|
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.
|
# someone must have activated the WAIT-button in ISMAS.
|
||||||
# Request the status of this button in updates_available().
|
# Request the status of this button in updates_available().
|
||||||
if ! updates_available; then
|
while [ $ismas_requests -le 3 ]; do
|
||||||
update_psa_false_alarm "update requested, but no WAIT state detected !!!"
|
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 !!!"
|
log_fatal "update_psa:${LINENO}: update requested, but no WAIT state detected !!!"
|
||||||
fi
|
fi
|
||||||
else
|
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
|
set_updates_available
|
||||||
while :
|
while [ $ismas_requests -le 10 ]; do
|
||||||
do
|
|
||||||
sleep 5
|
sleep 5
|
||||||
updates_available && break
|
updates_available && break
|
||||||
|
ismas_requests=$(( $ismas_requests + 1 ))
|
||||||
|
log_info "${func}:${LINENO}: updates_requested <$ismas_requests>"
|
||||||
done
|
done
|
||||||
|
if [ $ismas_requests -gt 10 ]; then
|
||||||
|
log_fatal "${func}:${LINENO}: NO ISMAS UPDATES AVAILABLE"
|
||||||
|
fi
|
||||||
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
|
# Fetch new updates (using git). but only when repository has already been
|
||||||
# cloned.
|
# cloned.
|
||||||
if ! fetch_customer_updates; then
|
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_psa_false_alarm \
|
||||||
"update request, but no change in $CUSTOMER_REPOSITORY_PATH"
|
"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
|
fi
|
||||||
|
|
||||||
update_psa_pull_customer_repository # message to ISMAS
|
update_psa_pull_customer_repository # message to ISMAS
|
||||||
|
Loading…
Reference in New Issue
Block a user