From e4237ccc797cbf97701ede38842b5c1925c5e012 Mon Sep 17 00:00:00 2001
From: Bob Ball <bob.ball@citrix.com>
Date: Wed, 24 Sep 2014 17:50:50 +0100
Subject: [PATCH] Move static definition of forwarding.conf later in script

While the original implementation may have been to save the nameservers
given by the provider, we now just use a static nameserver.  As such we
can define the contents of forwarding.conf later and help avoid any
potential race conditions, such as that in bug 1373505.

Change-Id: I921cca03a6915f1e7b471d1bf90b82abcb1a0606
related-bug: 1373505
---
 .../files/nodepool/scripts/prepare_node.sh       | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/modules/openstack_project/files/nodepool/scripts/prepare_node.sh b/modules/openstack_project/files/nodepool/scripts/prepare_node.sh
index 90e5c4dd32..63f93a93ed 100755
--- a/modules/openstack_project/files/nodepool/scripts/prepare_node.sh
+++ b/modules/openstack_project/files/nodepool/scripts/prepare_node.sh
@@ -23,13 +23,6 @@ PYTHON3=${4:-false}
 PYPY=${5:-false}
 ALL_MYSQL_PRIVS=${6:-false}
 
-# Save the nameservers configured by our provider.
-cat >/tmp/forwarding.conf <<EOF
-forward-zone:
-  name: "."
-  forward-addr: 8.8.8.8
-EOF
-
 sudo hostname $HOSTNAME
 # Fedora image doesn't come with wget
 if [ -f /usr/bin/yum ]; then
@@ -48,9 +41,12 @@ else
 	-e "class {'openstack_project::single_use_slave': install_users => false, sudo => $SUDO, bare => $BARE, python3 => $PYTHON3, include_pypy => $PYPY, all_mysql_privs => $ALL_MYSQL_PRIVS, ssh_key => '$NODEPOOL_SSH_KEY', }"
 fi
 
-# The puppet modules should install unbound.  Take the nameservers
-# that we ended up with at boot and configure unbound to forward to
-# them.
+# The puppet modules should install unbound.  Set up some nameservers.
+cat >/tmp/forwarding.conf <<EOF
+forward-zone:
+  name: "."
+  forward-addr: 8.8.8.8
+EOF
 sudo mv /tmp/forwarding.conf /etc/unbound/
 sudo chown root:root /etc/unbound/forwarding.conf
 sudo chmod a+r /etc/unbound/forwarding.conf