Compare commits

...

4 Commits

5 changed files with 35 additions and 21 deletions

View File

@ -188,7 +188,7 @@ pull_customer_repository () {
# If 'git pull' has fetched new data, then there are lines starting with
# DOWNLOAD or EXECUTE.
grep -E -q "^[[:space:]]*(DOWNLOAD|EXECUTE)" "$GIT_UPDATE_LOG"
if [ $? -eq 0]; then
if [ $? -eq 0 ]; then
log_info "$func:${LINENO}: new data fetched from repository"
cd_home; return 0
fi

View File

@ -18,6 +18,7 @@ if [ "${log_helpers_sourced:-1}" = "1" ]; then # include only once
readonly MAX_DEBUG_LEVEL=6
log_level=$INFO
FATAL_FAILURE=false
set_dbg_level () {
if [ $1 < $MAX_DEBUG_LEVEL ]; then
@ -83,6 +84,7 @@ if [ "${log_helpers_sourced:-1}" = "1" ]; then # include only once
if [ $log_level -le $FATAL ]; then
log "FATAL $*"
log "exiting ..."
FATAL_FAILURE=true
exit 1
fi
}

View File

@ -5,6 +5,7 @@
# UPDATE PSA
# Usage:
# update_psa [ --? ]
# [ -m ]
# [ --help ]
# [ --wdir "working_directory" ]
# [ --file "config_file" ]
@ -23,9 +24,15 @@ if [ -z $IFS ]; then
IFS=$'\n'
fi
MAINTENANCE="NO"
# parse commandline parameters
while test $# -gt 0; do
case $1 in
--maintenance | -m )
shift
MAINTENANCE="YES"
;;
--file | --fil | --fi | --f | -file | -fil | -fi | -f )
shift
CONFIGFILENAME="$1"
@ -47,6 +54,7 @@ while test $# -gt 0; do
exit 0
;;
--dbg | --db | --d | -dbg | -db | -d )
shift
set_dbg_level $DEBUG
;;
-*)
@ -71,14 +79,24 @@ if cd "$WORKING_DIRECTORY"; then
then
check_sanity_of_repository
if [ "$MAINTENANCE" = "NO" ]; then
log_info "update_psa:${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 !!!"
log_fatal "update_psa:${LINENO}: update requested, but no WAIT state detected !!!"
fi
else
# simulate an activated WAIT-button
set_updates_available
while :
do
sleep 5
updates_available && break
done
#update_psa "testing"
fi
# updates available
update_psa
fi
fi

View File

@ -378,7 +378,7 @@ check_for_running_apism () {
if nc localhost 7778
then
APISM_RUNNING=1
log_debug "$func:${LINENO}: APISM running..."
log_info "$func:${LINENO}: APISM is running..."
return 0
fi
log_fatal "$func:${LINENO}: !!! APISM NOT RUNNING !!!"
@ -388,7 +388,7 @@ check_default_route () {
local func="${FUNCNAME[0]}"
if ip route | head -n 1 | grep -q '^default'
then
log_debug "$func:${LINENO}: default route set"
log_info "$func:${LINENO}: default route set"
return 0
fi
log_fatal "$func:${LINENO}: !!! NO DEFAULT ROUTE SET !!!"
@ -400,7 +400,7 @@ check_route_to_repository () {
# 185.191.219.134 via 192.168.5.254 ...
if test "$#" -eq 1 && ip route get "$1" | head -n 1 | grep -q "^$1"
then
log_debug "$func:${LINENO}: route to repository available"
log_info "$func:${LINENO}: route to repository available"
return 0
fi
log_fatal "$func:${LINENO}: !!! NO ROUTE TO REPO SET !!!"

View File

@ -13,6 +13,8 @@ trap collect_current_configuration EXIT
collect_current_configuration () {
local func="${FUNCNAME[0]}"
$FATAL_FAILURE && return 1
# TODO: eventuell muss die version neu berechnet werden
current_settings_to_ismas
@ -28,15 +30,7 @@ collect_current_configuration () {
#done
}
update_psa() { # calling with a parameter is used for testing
if [ $# -eq 0 ]; then
if ! updates_available; then # check for false alarm
update_psa_false_alarm "update requested, but no WAIT state detected"
exit $EXITCODE
fi
fi
update_psa() {
update_psa_activated # message to ISMAS
local func="${FUNCNAME[0]}"