Browse Source

Merge pull request #5433 from sdodson/resolvconf

Automatic merge from submit-queue

Ensure valid search on resolv.conf

On cluster without internal name resolution there will be no `search XXX` on /etc/resolv.conf at all, thus this script will fail to add an entry for `cluster.local`.

Forward ports #5398
OpenShift Merge Robot 7 years ago
parent
commit
8c4380f5f6

+ 2 - 0
roles/openshift_node_dnsmasq/files/networkmanager/99-origin-dns.sh

@@ -114,6 +114,8 @@ EOF
       echo "nameserver "${def_route_ip}"" >> ${NEW_RESOLV_CONF}
       if ! grep -q 'search.*cluster.local' ${NEW_RESOLV_CONF}; then
         sed -i '/^search/ s/$/ cluster.local/' ${NEW_RESOLV_CONF}
+      elif ! grep -qw search ${NEW_RESOLV_CONF}; then
+        echo 'search cluster.local' >> ${NEW_RESOLV_CONF}
       fi
       cp -Z ${NEW_RESOLV_CONF} /etc/resolv.conf
     fi