Fix getting cluster_domain and changing dns 76/1176/1
authorYolanda Robla <yroblamo@redhat.com>
Fri, 12 Jul 2019 11:34:39 +0000 (13:34 +0200)
committerYolanda Robla <yroblamo@redhat.com>
Fri, 12 Jul 2019 11:36:04 +0000 (13:36 +0200)
The parameter for cluster_domain was not being
propagated correctly, fixing it.
Also always overwriting the openshift.conf file
because right now, if domain was changed, it
was not updated properly.

Signed-off-by: Yolanda Robla <yroblamo@redhat.com>
Change-Id: I71d161846b63a11d76edf8b5386b19c63bdb4b44

utils/prep_host.sh

index cc51a53..5a1a38a 100755 (executable)
@@ -72,20 +72,13 @@ EOF
 
     # Set up NetworkManager DNS overlay
     dnsconf=/etc/NetworkManager/conf.d/openshift.conf
-    local dnschanged=""
-    if ! [ -f "${dnsconf}" ]; then
-        echo -e "[main]\ndns=dnsmasq" | sudo tee "${dnsconf}"
-        dnschanged=1
-    fi
+    echo -e "[main]\ndns=dnsmasq" | sudo tee "${dnsconf}"
+
     dnsmasqconf=/etc/NetworkManager/dnsmasq.d/openshift.conf
-    if ! [ -f "${dnsmasqconf}" ]; then
-        echo server=/$cluster_domain/192.168.126.1 | sudo tee "${dnsmasqconf}"
-        echo address=/.apps.$cluster_domain/192.168.126.51 | sudo tee -a "${dnsmasqconf}"
-        dnschanged=1
-    fi
-    if [ -n "$dnschanged" ]; then
-        sudo systemctl restart NetworkManager
-    fi
+    rm $dnsmasqconf
+    echo server=/$cluster_domain/192.168.126.1 | sudo tee "${dnsmasqconf}"
+    echo address=/.apps.$cluster_domain/192.168.126.51 | sudo tee -a "${dnsmasqconf}"
+    sudo systemctl restart NetworkManager
 
     # Create an entry in the /etc/host
     grep -q 'libvirt.default' /etc/hosts
@@ -109,4 +102,4 @@ then
     exit 1
 fi
 
-prerequisites
+prerequisites $1