summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node_dnsmasq
diff options
context:
space:
mode:
authorIshentRas <william17.burton@gmail.com>2016-06-13 11:05:57 +0100
committerIshentRas <william17.burton@gmail.com>2016-06-13 11:05:57 +0100
commita069be8c5c54ff1661baa992d3f0e89afd6c92b6 (patch)
tree1fb2abde3604f2657f0f9052e18f115b6af8304d /roles/openshift_node_dnsmasq
parentfea08b9ba213b69667e103ff9dfd4383218e9eac (diff)
downloadopenshift-a069be8c5c54ff1661baa992d3f0e89afd6c92b6.tar.gz
openshift-a069be8c5c54ff1661baa992d3f0e89afd6c92b6.tar.bz2
openshift-a069be8c5c54ff1661baa992d3f0e89afd6c92b6.tar.xz
openshift-a069be8c5c54ff1661baa992d3f0e89afd6c92b6.zip
- Prevent the script to override n number of the time the same nameserver
- Prevent the script to echo blank values from IP4_NAMESERVERS variable
Diffstat (limited to 'roles/openshift_node_dnsmasq')
-rwxr-xr-xroles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh b/roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh
index 51a43d113..5a187710b 100755
--- a/roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh
+++ b/roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh
@@ -47,11 +47,14 @@ EOF
# zero out our upstream servers list and feed it into dnsmasq
echo -n > /etc/dnsmasq.d/origin-upstream-dns.conf
for ns in ${IP4_NAMESERVERS}; do
- echo "server=${ns}" >> /etc/dnsmasq.d/origin-upstream-dns.conf
+ if [[ ! -z $ns ]]; then
+ echo "server=${ns}" >> /etc/dnsmasq.d/origin-upstream-dns.conf
+ fi
done
systemctl restart dnsmasq
- sed -i 's/^nameserver.*$/nameserver '"${def_route_ip}"'/g' /etc/resolv.conf
+ sed -i '0,/^nameserver/ s/^nameserver.*$/nameserver '"${def_route_ip}"'/g' /etc/resolv.conf
+
if ! grep -q '99-origin-dns.sh' /etc/resolv.conf; then
echo "# nameserver updated by /etc/NetworkManager/dispatcher.d/99-origin-dns.sh" >> /etc/resolv.conf
fi