diff options
| author | Jeffrey Zhang <jeffrey.zhang@99cloud.net> | 2016-08-18 14:29:54 +0800 |
|---|---|---|
| committer | Jeffrey Zhang <zhang.lei.fly@gmail.com> | 2016-08-31 21:51:08 +0800 |
| commit | 96bf1cfee4fe4d9ebe6d6bfe7b7ce93a12d6a5c3 (patch) | |
| tree | 61c672d8cd5412f2a2895e2a72c1c053dac1d227 | |
| parent | 5a21032fb0b1304058e1345d132f004b61a00422 (diff) | |
| download | kolla-96bf1cfee4fe4d9ebe6d6bfe7b7ce93a12d6a5c3.tar.gz kolla-96bf1cfee4fe4d9ebe6d6bfe7b7ce93a12d6a5c3.zip | |
Add warning to kolla-ansible destroy action
Change-Id: Id7591dff978b8fb7ba2c59331ffd83a77ecf46ab
Closes-Bug: #1610546
Signed-off-by: Jeffrey Zhang <zhang.lei.fly@gmail.com>
| -rwxr-xr-x | tools/kolla-ansible | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/kolla-ansible b/tools/kolla-ansible index 030f0323e..db6883cd1 100755 --- a/tools/kolla-ansible +++ b/tools/kolla-ansible @@ -55,7 +55,7 @@ EOF SHORT_OPTS="hi:p:t:k:e:v" -LONG_OPTS="help,inventory:,playbook:,tags:,key:,extra:,verbose,configdir:,passwords:" +LONG_OPTS="help,inventory:,playbook:,tags:,key:,extra:,verbose,configdir:,passwords:,yes-i-really-really-mean-it" ARGS=$(getopt -o "${SHORT_OPTS}" -l "${LONG_OPTS}" --name "$0" -- "$@") || { usage >&2; exit 2; } eval set -- "$ARGS" @@ -68,6 +68,7 @@ VERBOSITY= EXTRA_OPTS= CONFIG_DIR="/etc/kolla" PASSWORDS_FILE="${CONFIG_DIR}/passwords.yml" +DANGER_CONFIRM= while [ "$#" -gt 0 ]; do case "$1" in @@ -97,6 +98,11 @@ while [ "$#" -gt 0 ]; do shift 2 ;; + (--yes-i-really-really-mean-it) + DANGER_CONFIRM="$1" + shift 1 + ;; + (--key|-k) VAULT_PASS_FILE="$2" EXTRA_OPTS="$EXTRA_OPTS --vault-password-file=$VAULT_PASS_FILE" @@ -143,6 +149,15 @@ case "$1" in (destroy) ACTION="Destroy Kolla containers, volumes and host configuration" PLAYBOOK="${BASEDIR}/ansible/destroy.yml" + if [[ "${DANGER_CONFIRM}" != "--yes-i-really-really-mean-it" ]]; then + cat << EOF +WARNING: + This will PERMANENTLY DESTROY all deployed kolla containers, volumes and host configuration. + There is no way to recover from this action. To confirm, please add the following option: + --yes-i-really-really-mean-it +EOF + exit 1 + fi ;; (deploy) ACTION="Deploying Playbooks" |
