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
This commit is contained in:
yuqian 2018-06-23 13:47:56 +08:00
parent 13cf0e05bd
commit 8f156691ce

View File

@ -106,6 +106,8 @@ EOF
SHORT_OPTS="hi:p:t:k:e:v" 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" 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; } ARGS=$(getopt -o "${SHORT_OPTS}" -l "${LONG_OPTS}" --name "$0" -- "$@") || { usage >&2; exit 2; }
eval set -- "$ARGS" eval set -- "$ARGS"
@ -159,7 +161,10 @@ while [ "$#" -gt 0 ]; do
;; ;;
(--yes-i-really-really-mean-it) (--yes-i-really-really-mean-it)
DANGER_CONFIRM="$1" if [[ ${RAW_ARGS} =~ "$1" ]]
then
DANGER_CONFIRM="$1"
fi
shift 1 shift 1
;; ;;