patch.sh: Exit on patch apply failure 79/45079/1
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Mon, 25 Sep 2017 23:16:54 +0000 (01:16 +0200)
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>
Fri, 13 Oct 2017 21:42:11 +0000 (21:42 +0000)
Patches that fail to apply are silently skipped. Since retrying is
not possible, deploy moves on, making the problem hard to observe.

Change-Id: I3fe01cef6b245de53767a660b9b4fdfae0d5d0ff
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
(cherry picked from commit bd0259e7bb5f045a1ba7958d79039848d062aad1)

mcp/patches/patch.sh
mcp/scripts/salt.sh

index 6cd65fd..b56ebb8 100755 (executable)
@@ -1,8 +1,9 @@
-#!/bin/bash
+#!/bin/bash -ex
 
 if [ -r "$1" ]; then
   while IFS=': ' read -r p_dest p_file; do
-    [[ "${p_dest}" =~ $2 ]] && \
+    if [[ "${p_dest}" =~ $2 ]]; then
       patch -fd "${p_dest}" -p1 < "/root/fuel/mcp/patches/${p_file}"
+    fi
   done < "$1"
 fi
index b0a2687..73190e3 100755 (executable)
@@ -28,8 +28,9 @@ fi
 
 # ssh to cfg01
 # shellcheck disable=SC2086,2087
-ssh ${SSH_OPTS} "${SSH_SALT}" bash -s << SALT_INSTALL_END
+ssh ${SSH_OPTS} "${SSH_SALT}" bash -s -e << SALT_INSTALL_END
   sudo -i
+  set -e
 
   echo -n 'Checking out cloud-init has finished running ...'
   while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo -n '.'; sleep 1; done