summaryrefslogtreecommitdiff
path: root/global
diff options
context:
space:
mode:
Diffstat (limited to 'global')
-rwxr-xr-xglobal/overlay/etc/puppet/modules/sunet/templates/dockerhost/20unbound.erb20
1 files changed, 20 insertions, 0 deletions
diff --git a/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/20unbound.erb b/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/20unbound.erb
index 204e97c..0374ac7 100755
--- a/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/20unbound.erb
+++ b/global/overlay/etc/puppet/modules/sunet/templates/dockerhost/20unbound.erb
@@ -19,6 +19,26 @@ logtag="sunet_docker_pre-post[$ACTION]"
logger -t "${logtag}" "$NAME ($IMAGE), CID: '$CID'"
if [ "x$ACTION" = "xpre-start" ]; then
+ # Work-around: if unbound is not running when a container starts, it will get
+ # an incorrect /etc/resolv.conf (SUNET resolvers). It will then later on be
+ # unable to resolv .docker hostnames.
+ service unbound status > /dev/null
+ if [ $? -ne 0 ]; then
+ for retry in 1 2 3 4 5 6 7 8 9 10; do
+ sleep 3
+ logger -t "${logtag}" "Waiting for service unbound"
+ service unbound status > /dev/null
+ if [ $? -eq 0 ]; then
+ break
+ fi
+ done
+ fi
+
+ service unbound status > /dev/null
+ if [ $? -ne 0 ]; then
+ logger -t "${logtag}" "Service unbound not running! Aborting."
+ exit 0
+ fi
if [ -f "${CIDFILE}" ]; then
# Clean away the CID file in pre-start if the container is in fact not running
docker inspect "${CID}" 2>/dev/null || (