From a069be8c5c54ff1661baa992d3f0e89afd6c92b6 Mon Sep 17 00:00:00 2001 From: IshentRas Date: Mon, 13 Jun 2016 11:05:57 +0100 Subject: - Prevent the script to override n number of the time the same nameserver - Prevent the script to echo blank values from IP4_NAMESERVERS variable --- roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'roles') 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 -- cgit v1.2.3