aboutsummaryrefslogtreecommitdiff
path: root/docker/fedora-rdo-base
diff options
context:
space:
mode:
authorRyan Hallisey <rhallise@redhat.com>2015-03-10 17:04:38 -0400
committerRyan Hallisey <rhallise@redhat.com>2015-03-10 18:04:44 -0400
commita2dae48b87ccbd1b772d495f35a03af50b58958d (patch)
treebca7f1a80c667bf5b08165e84ab0da743901806f /docker/fedora-rdo-base
parent797960bf2608ae27773a0f2aa3ba8a47265fba66 (diff)
downloadkolla-a2dae48b87ccbd1b772d495f35a03af50b58958d.tar.gz
kolla-a2dae48b87ccbd1b772d495f35a03af50b58958d.zip
Glance containers need to be changed so they work without kubernetes
This patch overlaps a little bit with https://review.openstack.org/#/c/162358/. There were some additional glance config that needs to be added to run without kubernetes. Co-authored by: Charles Crouch (charcrou@cisco.com) Change-Id: I1aab2f6e4a80aaf1e6c4b7fe330bcf9a7740fdc6
Diffstat (limited to 'docker/fedora-rdo-base')
-rwxr-xr-xdocker/fedora-rdo-base/wait_for85
1 files changed, 85 insertions, 0 deletions
diff --git a/docker/fedora-rdo-base/wait_for b/docker/fedora-rdo-base/wait_for
new file mode 100755
index 000000000..16f2cc8c8
--- /dev/null
+++ b/docker/fedora-rdo-base/wait_for
@@ -0,0 +1,85 @@
+#!/bin/bash
+# Based on
+# https://raw.githubusercontent.com/openstack/tripleo-incubator/6931c1fc7ed98ce36998c5b82750a880b0365445/scripts/wait_for
+#
+# Copyright 2013 Red Hat
+# 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 -e # exit on the first non-zero status
+set -u # exit on unset variables
+#set -x # setting this actually breaks the scripts function
+
+SCRIPT_NAME=$(basename $0)
+
+
+function show_options() {
+ echo "Usage: $SCRIPT_NAME LOOPS_NUMBER SLEEP_TIME ARGS"
+ echo
+ echo "ARGS are read and concatenated together into a single command."
+ echo "Execute the command in a loop until it succeeds or the number"
+ echo "of attempts exceeds LOOPS_NUMBER value. After each failure"
+ echo "pause for SLEEP_TIME seconds."
+ echo
+ echo "An optional FAIL_MATCH_OUTPUT variable may also be set to control "
+ echo "if the loop exits early if the commands stdout/stderr matches the "
+ echo "supplied regex string."
+ echo
+ echo "Examples:"
+ echo " wait_for 30 10 ping -c 1 192.0.2.2"
+ echo " wait_for 10 1 ls file_we_are_waiting_for"
+ echo " wait_for 10 3 date \| grep 8"
+ echo " FAIL_MATCH_OUTPUT=CREATE_FAILED wait_for 30 10 heat stack-show undercloud"
+ echo " SUCCESSFUL_MATCH_OUTPUT=CREATE_COMPLETE wait_for 30 10 heat stack-show undercloud"
+ exit 1
+}
+
+
+LOOPS=${1:-""}
+SLEEPTIME=${2:-""}
+FAIL_MATCH_OUTPUT=${FAIL_MATCH_OUTPUT:-""}
+SUCCESSFUL_MATCH_OUTPUT=${SUCCESSFUL_MATCH_OUTPUT:-""}
+shift 2 || true
+COMMAND="$@"
+
+if [ -z "$LOOPS" -o -z "$SLEEPTIME" -o -z "$COMMAND" ]; then
+ show_options
+fi
+
+
+i=0
+while [ $i -lt $LOOPS ]; do
+ i=$((i + 1))
+ STATUS=0
+ OUTPUT=$(eval $COMMAND 2>&1) || STATUS=$?
+ if [[ -n "$SUCCESSFUL_MATCH_OUTPUT" ]] \
+ && [[ $OUTPUT =~ $SUCCESSFUL_MATCH_OUTPUT ]]; then
+ exit 0
+ elif [[ -n "$FAIL_MATCH_OUTPUT" ]] \
+ && [[ $OUTPUT =~ $FAIL_MATCH_OUTPUT ]]; then
+ echo "Command output matched '$FAIL_MATCH_OUTPUT'. Exiting..."
+ exit 1
+ elif [[ -z "$SUCCESSFUL_MATCH_OUTPUT" ]] && [[ $STATUS -eq 0 ]]; then
+ # The command successfully completed and we aren't testing against
+ # it's output so we have finished waiting.
+ exit 0
+ fi
+
+ sleep $SLEEPTIME
+done
+SECONDS=$((LOOPS * SLEEPTIME))
+printf 'Timing out after %d seconds:\nCOMMAND=%s\nOUTPUT=%s\n' \
+ "$SECONDS" "$COMMAND" "$OUTPUT"
+exit 1
+