Check if CONTAINER_IP could be determined (#2046)

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
Casper 2021-06-19 22:24:06 +02:00 committed by GitHub
parent 4822709000
commit 7293e3c9e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -208,3 +208,9 @@ function _monitored_files_checksums
)
}
export -f _monitored_files_checksums
function _shutdown
{
_notify 'err' "Shutting down.."
kill 1
}

View File

@ -25,7 +25,7 @@ function _check_hostname
if ! grep -q -E '^(\S+[.]\S+)$' <<< "${HOSTNAME}"
then
_notify 'err' 'Setting hostname/domainname is required'
kill "$(< /var/run/supervisord.pid)"
_shutdown
return 1
fi
}

View File

@ -1108,6 +1108,12 @@ function _setup_docker_permit
grep 'inet ' | sed 's|[^0-9\.\/]*||g' | cut -d '/' -f 1)
CONTAINER_NETWORK="$(echo "${CONTAINER_IP}" | cut -d '.' -f1-2).0.0"
if [[ -z ${CONTAINER_IP} ]]
then
_notify 'err' "Detecting the container IP address failed. Check if NETWORK_INTERFACE is correctly configured."
_shutdown
fi
while read -r IP
do
CONTAINER_NETWORKS+=("${IP}")
@ -1156,7 +1162,7 @@ function _setup_postfix_virtual_transport
if [[ -z ${POSTFIX_DAGENT} ]]
then
_notify 'err' "${POSTFIX_DAGENT} not set."
kill -15 "$(< /var/run/supervisord.pid)"
_shutdown
return 1
fi