]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
cobbler: Only write network config for our routable NIC wip-set-iface 377/head
authorDavid Galloway <dgallowa@redhat.com>
Thu, 8 Feb 2018 23:16:53 +0000 (18:16 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Fri, 9 Feb 2018 01:27:40 +0000 (20:27 -0500)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/cobbler/templates/snippets/cephlab_rc_local

index a08b9619f6a18b5fbf5eb5645c5db23295d64f89..e9d0c8dfdbfec5ee7c56661a95e6c01440aef222 100644 (file)
@@ -37,15 +37,21 @@ if [ ! -f /.cephlab_net_configured ]; then
       # Don't bail if NIC fails to come up
       set +e
       ifup $nic
-      if [ $? -ne 0 ]; then
-        # If the NIC failed to DHCP, delete its ifcfg script.  Must be static or tagged
-        rm -f /etc/sysconfig/network-scripts/ifcfg-$nic
+#end raw
+      if ! timeout 1s ping -I $nic -nq -c1 $http_server 2>&1 >/dev/null; then
+#raw
+        # If we can't ping our Cobbler host, remove the DHCP config for this NIC.
+        # It must either be on a non-routable network or has no reachable DHCP server.
         ifdown $nic
+        rm -f /etc/sysconfig/network-scripts/ifcfg-$nic
+        sed -i "/$nic/d" /etc/network/interfaces
       fi
-      # Go back to bailing if anything above fails on the next NIC
+      # Go back to bailing if anything fails bringing the next NIC up
       set -e
       # Write our lockfile so this only gets run on firstboot
       touch /.cephlab_net_configured
+      # Break out of the loop once we've found our routable NIC
+      break
     else
       # Take the NIC back down if it's not connected
       ifconfig $nic down