diff options
author | Johan Lundberg <lundberg@nordu.net> | 2015-04-28 13:24:58 +0200 |
---|---|---|
committer | Johan Lundberg <lundberg@nordu.net> | 2015-04-28 13:24:58 +0200 |
commit | 8ddca624ae074147d3845eb7b3764b271a735e2f (patch) | |
tree | 668023835a9717c043fedc5109431629fd012afa /global/overlay/etc/puppet/modules | |
parent | deeb38e36bf12b51535cae4a6e61ab145a0720d6 (diff) |
Make sure unbound is running in pre-start.
Diffstat (limited to 'global/overlay/etc/puppet/modules')
-rwxr-xr-x | global/overlay/etc/puppet/modules/sunet/templates/dockerhost/20unbound.erb | 20 |
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 || ( |