From 8f156691ce1da72218c666c32f01607d8a55b07b Mon Sep 17 00:00:00 2001 From: yuqian Date: Sat, 23 Jun 2018 13:47:56 +0800 Subject: [PATCH] fixed destroy confirmation no properly evaluated To destroy a kolla-ansible environment a confirmation string should be passed along with kolla-ansible command: kolla-ansible destroy -i ~/multinode \ --yes-i-really-really-mean-it However, this string is not evaluated right and just putting --y starts destroy process: ./kolla-ansible destroy -i ~/multinode --y Change-Id: I5983f9c7fd3859d60741dfd23ad10dfd91872eeb Closes-Bug: #1701313 --- tools/kolla-ansible | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/kolla-ansible b/tools/kolla-ansible index 28435f6b57..eb29e7b3ef 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -106,6 +106,8 @@ EOF SHORT_OPTS="hi:p:t:k:e:v" LONG_OPTS="help,inventory:,playbook:,skip-tags:,tags:,key:,extra:,verbose,configdir:,passwords:,limit:,vault-id:,ask-vault-pass,vault-password-file:,yes-i-really-really-mean-it,include-images,include-dev" + +RAW_ARGS="$*" ARGS=$(getopt -o "${SHORT_OPTS}" -l "${LONG_OPTS}" --name "$0" -- "$@") || { usage >&2; exit 2; } eval set -- "$ARGS" @@ -159,7 +161,10 @@ while [ "$#" -gt 0 ]; do ;; (--yes-i-really-really-mean-it) - DANGER_CONFIRM="$1" + if [[ ${RAW_ARGS} =~ "$1" ]] + then + DANGER_CONFIRM="$1" + fi shift 1 ;;