From 9099b99f00aca533e7e8429348dd870c3e7f0732 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Wed, 13 Nov 2019 11:33:18 -0500 Subject: [PATCH] cobbler: Don't quit rc.local if anything fails 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 --- roles/cobbler/templates/snippets/cephlab_rc_local | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/roles/cobbler/templates/snippets/cephlab_rc_local b/roles/cobbler/templates/snippets/cephlab_rc_local index 895f570f..c6eee7ec 100644 --- a/roles/cobbler/templates/snippets/cephlab_rc_local +++ b/roles/cobbler/templates/snippets/cephlab_rc_local @@ -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 -- 2.47.3