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)
-#!/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
 
 
 # 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