From e431387e57bc758f650bb49917b919dbeb9c419c Mon Sep 17 00:00:00 2001 From: Mykola Malkov Date: Thu, 30 Aug 2018 12:08:58 +0300 Subject: [PATCH] TT#43251 Move wait for ngcpstatus seconds to separate function If 'systemctl reboot|halt' is called within script 'trap' function is not called so deployment.sh does not wait and jenkins can miss the status. Move waiting to separate function and call it directly so there is waiting in the end of deployment.sh in any case. Change-Id: Ib93bf6fd4e6f133c9342d02d412ea1f18cdceba6 --- templates/scripts/includes/deployment.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/templates/scripts/includes/deployment.sh b/templates/scripts/includes/deployment.sh index c841ea2..287ac1f 100755 --- a/templates/scripts/includes/deployment.sh +++ b/templates/scripts/includes/deployment.sh @@ -306,9 +306,7 @@ ensure_packages_installed() { done } -wait_exit() { - local e_code="${?}" - trap '' 1 2 3 6 15 ERR EXIT +status_wait() { if [[ -n "${STATUS_WAIT}" ]] && [[ "${STATUS_WAIT}" != 0 ]]; then # if ngcpstatus boot option is used wait for a specific so a # remote host has a chance to check for deploy status "finished", @@ -316,7 +314,12 @@ wait_exit() { echo "Sleeping for ${STATUS_WAIT} seconds (as requested via boot option 'ngcpstatus')" sleep "${STATUS_WAIT}" fi +} +wait_exit() { + local e_code="${?}" + trap '' 1 2 3 6 15 ERR EXIT + status_wait exit "${e_code}" } @@ -1983,6 +1986,8 @@ if "$INTERACTIVE" ; then exit 0 fi +status_wait + # do not prompt when running in automated mode if "$REBOOT" ; then echo "Rebooting system as requested via ngcpreboot"