]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
cobbler: Don't quit rc.local if anything fails wip-rc-noquit
authorDavid Galloway <dgallowa@redhat.com>
Wed, 13 Nov 2019 16:33:18 +0000 (11:33 -0500)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 13 Nov 2019 16:33:18 +0000 (11:33 -0500)
exiting 1 if anything breaks doesn't do us any favors.  What ends up happening is it seems like the system was reimaged but users can't log in because ansible never gets run.  Only admins can log in as the cm user to investigate and even then, since we're outputting to the SOL console, one has to be watching the SOL console for errors when a system is reprovisioned with Cobbler.

If the system fails to get its networking set up, then the ansible tasks won't be able to run anyway.  If ansible fails, there's still the `|| true` at the end so, again, no purpose in having `set -e` anywhere in this script.

Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/cobbler/templates/snippets/cephlab_rc_local

index 895f570f6140144e77a70d451fb37b35ee18e3d9..c6eee7ece15ca6de7b1895f28c0a61543971bb8a 100644 (file)
@@ -19,7 +19,7 @@ cat > $script <<\EOF
 # Redirect rc.local output to our console so it's in teuthology console logs
 exec 2> /dev/ttyS1
 exec 1>&2
-set -ex
+set -x
 
 {% if rclocal_nameserver is defined %}
 if [ ! -f /.cephlab_net_configured ]; then
@@ -43,8 +43,6 @@ 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
       ifup $nic
@@ -62,8 +60,6 @@ if [ ! -f /.cephlab_net_configured ]; then
         ifdown $nic
         rm -f /etc/sysconfig/network-scripts/ifcfg-$nic
         sed -i "/$nic/d" /etc/network/interfaces
-        # Go back to bailing if anything fails bringing the next NIC up
-        set -e
       else
         # We found our routable NIC!
         # Write our lockfile so this only gets run on firstboot
@@ -78,9 +74,6 @@ if [ ! -f /.cephlab_net_configured ]; then
   done
 fi
 
-# Don't error out if the `ip` command returns rc 1
-set +e
-
 attempts=0
 myips=""
 until [ "$myips" != "" ] || [ $attempts -ge 10 ]; do
@@ -89,8 +82,6 @@ until [ "$myips" != "" ] || [ $attempts -ge 10 ]; do
   sleep 1
 done
 
-set -e
-
 if [ -n "$myips" ]; then
   for ip in $myips; do
     if timeout 1s ping -I $ip -nq -c1 {{ rclocal_nameserver }} 2>&1 >/dev/null; then