From: David Galloway Date: Thu, 10 Oct 2019 17:20:36 +0000 (-0400) Subject: cobbler: Allow ifdown to fail during rc.local X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e6d074b6fcf792d2ab9dc6ff2b0ed325be2698e0;p=ceph-cm-ansible.git cobbler: Allow ifdown to fail during rc.local Behavior changed in RHEL8. See example below. ``` + ifdown enp3s0f1 Error: '/etc/sysconfig/network-scripts/ifcfg-enp3s0f1' is not an active connection. Error: no active connection provided. ``` Then the script would quit. Signed-off-by: David Galloway --- diff --git a/roles/cobbler/templates/snippets/cephlab_rc_local b/roles/cobbler/templates/snippets/cephlab_rc_local index 000e8d3..895f570 100644 --- a/roles/cobbler/templates/snippets/cephlab_rc_local +++ b/roles/cobbler/templates/snippets/cephlab_rc_local @@ -43,10 +43,10 @@ if [ ! -f /.cephlab_net_configured ]; then else echo -e "DEVICE=$nic\nBOOTPROTO=dhcp\nONBOOT=yes" > /etc/sysconfig/network-scripts/ifcfg-$nic fi + # Don't bail if NIC fails to go down or come up + set +e # Bounce the NIC so it gets a DHCP address ifdown $nic - # Don't bail if NIC fails to come up - set +e ifup $nic attempts=0 # Try for 5 seconds to ping our Cobbler host