From 58d0daef9bd97439abba8fbfc9e63f2a8b0884cc Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Fri, 31 Jul 2015 09:50:57 -0500 Subject: [PATCH] Use playbook status to report upgrade failure Previously, we simply checked $? which at that point would be the exit status of echo, not openstack-ansible. By recording the actual openstack-ansible exit status, we can properly report failures of the upgrade script. Closes-bug: 1480342 Change-Id: Icf43bea84660e4160a2dfcdb4ac93055340b3573 (cherry picked from commit 8a106d184a566f1baed616aee7747d5f2d581c1b) --- scripts/run-upgrade.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/run-upgrade.sh b/scripts/run-upgrade.sh index 7bf869d7ed..4cde90aa34 100755 --- a/scripts/run-upgrade.sh +++ b/scripts/run-upgrade.sh @@ -81,9 +81,10 @@ function run_lock() { # Into a command, otherwise we'll get an error that there's no playbook # named || eval "openstack-ansible $2" + playbook_status="$?" echo "ran $run_item" - if [ "$?" == "0" ];then + if [ "$playbook_status" == "0" ];then RUN_TASKS=("${RUN_TASKS[@]/$run_item}") touch "$upgrade_marker" echo "$run_item has been marked as success"