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 8a106d184a)
This commit is contained in:
Ian Cordasco 2015-07-31 09:50:57 -05:00 committed by Jesse Pretorius
parent 4c9d94880f
commit 58d0daef9b

View File

@ -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"