summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2016-05-26 10:24:07 -0400
committerScott Dodson <sdodson@redhat.com>2016-05-26 10:45:18 -0400
commit70f54810a5f1be527a983e273d9474a99d75ee7d (patch)
tree9a22ab41b0345f876e622f298bdc6c7da10f782a
parent437c45074b28868845725ae714195fb575934517 (diff)
downloadopenshift-70f54810a5f1be527a983e273d9474a99d75ee7d.tar.gz
openshift-70f54810a5f1be527a983e273d9474a99d75ee7d.tar.bz2
openshift-70f54810a5f1be527a983e273d9474a99d75ee7d.tar.xz
openshift-70f54810a5f1be527a983e273d9474a99d75ee7d.zip
Use grep to decide when to add our comment
According to the man page for resolv.conf # needs to be in the first collumn in order to start a comment. While this didn't seem to affect glibc's resolver it did really confuse the kubelet which parses the host's resolv.conf
-rwxr-xr-xroles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh5
1 files changed, 4 insertions, 1 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 0d7941e4c..51a43d113 100755
--- a/roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh
+++ b/roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh
@@ -51,6 +51,9 @@ EOF
done
systemctl restart dnsmasq
- sed -i 's/^nameserver.*$/nameserver '"${def_route_ip}"' # updated by \/etc\/NetworkManager\/dispatcher.d\/99-origin-dns.sh/g' /etc/resolv.conf
+ sed -i '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
fi
fi