tripleo-incubator/scripts/wait_for_stack_ready
Tomas Hancock e7662340aa Don't wait for a failed update.
Just as for a failed 'heat stack create', don't wait about if a
'heat stack update' fails.

Change-Id: I49c07666f2555f1b6a072adc707ecb2b879fba6c
2014-04-28 11:32:15 +01:00

37 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
set -eu
SCRIPT_NAME=$(basename $0)
LOOPS=${1:-""}
SLEEPTIME=${2:-""}
STACK_NAME=${3:-""}
if [ -z "$LOOPS" -o -z "$SLEEPTIME" -o -z "$STACK_NAME" ]; then
echo "Usage: $SCRIPT_NAME LOOPS_NUMBER SLEEP_TIME STACK_NAME"
exit 1
fi
SUCCESSFUL_MATCH_OUTPUT="(CREATE|UPDATE)_COMPLETE"
FAIL_MATCH_OUTPUT="(CREATE|UPDATE)_FAILED"
SUCCESSFUL_MATCH_OUTPUT=$SUCCESSFUL_MATCH_OUTPUT \
FAIL_MATCH_OUTPUT=$FAIL_MATCH_OUTPUT \
wait_for $1 $2 \
"heat stack-show $STACK_NAME | awk '/stack_status / { print \$4 }'"