Added check_default_route and check_route_for_repository.

This commit is contained in:
Gerhard Hoffmann 2022-06-25 15:11:49 +02:00
parent 9b1549306d
commit fc1c2221b1

View File

@ -374,7 +374,43 @@ cleanup_previous_version() {
} }
check_for_apism () { check_for_apism () {
nc localhost 7778 local func="${FUNCNAME[0]}"
if nc localhost 7778; then
APISM_RUNNING=1
log_debug "$func:${LINENO}: APISM running..."
return 0
else
log_crit "$func:${LINENO}: *************************"
log_crit "$func:${LINENO}: !!! APISM NOT RUNNING !!!"
log_crit "$func:${LINENO}: *************************"
fi
return 1
}
check_default_route () {
if ip route | head -n 1 | grep -q '^default'
log_debug "$func:${LINENO}: default route set"
return 0
then
log_crit "$func:${LINENO}: ***************************************"
log_crit "$func:${LINENO}: !!! NO DEFAULT ROUTE SET !!! Exiting..."
log_crit "$func:${LINENO}: ***************************************"
exit 1
fi
}
check_route_to_repository () {
# ip_address=$1, e.g. git.mimbach.de (185.191.219.134)
# 185.191.219.134 via 192.168.5.254 ...
if test "$#" -eq 1 && ip route get "$1" | head -n 1 | grep -q "^$1"
log_debug "$func:${LINENO}: route to repository available"
return 0
then
log_crit "$func:${LINENO}: ***************************************"
log_crit "$func:${LINENO}: !!! NO ROUTE TO REPO SET !!! Exiting..."
log_crit "$func:${LINENO}: ***************************************"
exit 1
fi
} }
get_customer_id () { get_customer_id () {