Add --force for undeploy

This commit is contained in:
decentral1se 2021-03-18 17:18:35 +01:00
parent 8df91de3af
commit e5e98d536a
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A

102
abra
View File

@ -32,7 +32,7 @@ Usage:
abra [options] app <app> secret generate (<secret> <version>|--all) [<cmd>] [--pass] abra [options] app <app> secret generate (<secret> <version>|--all) [<cmd>] [--pass]
abra [options] app <app> secret insert <secret> <version> <data> [--pass] abra [options] app <app> secret insert <secret> <version> <data> [--pass]
abra [options] app <app> secret (rm|delete) (<secret>|--all) [--pass] [--force] abra [options] app <app> secret (rm|delete) (<secret>|--all) [--pass] [--force]
abra [options] app <app> undeploy abra [options] app <app> undeploy [--force]
abra [options] app <app> <command> [<args>...] abra [options] app <app> <command> [<args>...]
abra [options] server add <host> [<user>] [<port>] abra [options] server add <host> [<user>] [<port>]
abra [options] server new <provider> abra [options] server new <provider>
@ -157,17 +157,17 @@ eval "var_$1+=($value)"; else eval "var_$1=$value"; fi; return 0; fi; done
return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() { return 1; }; stdout() { printf -- "cat <<'EOM'\n%s\nEOM\n" "$1"; }; stderr() {
printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() { printf -- "cat <<'EOM' >&2\n%s\nEOM\n" "$1"; }; error() {
[[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() { [[ -n $1 ]] && stderr "$1"; stderr "$usage"; _return 1; }; _return() {
printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2027} printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2037}
usage=${DOC:40:1491}; digest=64041 usage=${DOC:40:1501}; digest=a1dde
shorts=(-s -e -U -d -h -v -C -b '' '' '' '' '' '' '' '' '' '' '' '' '' '') shorts=(-U -e -h -s -v -b -d -C '' '' '' '' '' '' '' '' '' '' '' '' '' '')
longs=(--stack --env --skip-update --debug --help --verbose --skip-check --branch --status --server --type --domain --app-name --pass --secrets --all --update --force --volumes --no-tty --user --dev) longs=(--skip-update --env --help --stack --verbose --branch --debug --skip-check --status --server --type --domain --app-name --pass --secrets --all --update --force --volumes --no-tty --user --dev)
argcounts=(1 1 0 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 0 1 0); node_0(){ argcounts=(0 1 0 1 0 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 1 0); node_0(){
value __stack 0; }; node_1(){ value __env 1; }; node_2(){ switch __skip_update 2 switch __skip_update 0; }; node_1(){ value __env 1; }; node_2(){ switch __help 2
}; node_3(){ switch __debug 3; }; node_4(){ switch __help 4; }; node_5(){ }; node_3(){ value __stack 3; }; node_4(){ switch __verbose 4; }; node_5(){
switch __verbose 5; }; node_6(){ switch __skip_check 6; }; node_7(){ value __branch 5; }; node_6(){ switch __debug 6; }; node_7(){
value __branch 7; }; node_8(){ switch __status 8; }; node_9(){ value __server 9 switch __skip_check 7; }; node_8(){ switch __status 8; }; node_9(){
}; node_10(){ value __type 10; }; node_11(){ value __domain 11; }; node_12(){ value __server 9; }; node_10(){ value __type 10; }; node_11(){ value __domain 11
value __app_name 12; }; node_13(){ switch __pass 13; }; node_14(){ }; node_12(){ value __app_name 12; }; node_13(){ switch __pass 13; }; node_14(){
switch __secrets 14; }; node_15(){ switch __all 15; }; node_16(){ switch __secrets 14; }; node_15(){ switch __all 15; }; node_16(){
switch __update 16; }; node_17(){ switch __force 17; }; node_18(){ switch __update 16; }; node_17(){ switch __force 17; }; node_18(){
switch __volumes 18; }; node_19(){ switch __no_tty 19; }; node_20(){ switch __volumes 18; }; node_19(){ switch __no_tty 19; }; node_20(){
@ -210,7 +210,7 @@ either 103 15; }; node_105(){ required 104; }; node_106(){ optional 31; }
node_107(){ required 67 39 23 55 56 105 106 76; }; node_108(){ node_107(){ required 67 39 23 55 56 105 106 76; }; node_108(){
required 67 39 23 55 57 29 30 32 76; }; node_109(){ either 29 15; }; node_110(){ required 67 39 23 55 57 29 30 32 76; }; node_109(){ either 29 15; }; node_110(){
required 109; }; node_111(){ required 67 39 23 55 93 110 76 83; }; node_112(){ required 109; }; node_111(){ required 67 39 23 55 93 110 76 83; }; node_112(){
required 67 39 23 58; }; node_113(){ optional 100; }; node_114(){ required 67 39 23 58 83; }; node_113(){ optional 100; }; node_114(){
required 67 39 23 33 113; }; node_115(){ optional 35; }; node_116(){ optional 36 required 67 39 23 33 113; }; node_115(){ optional 35; }; node_116(){ optional 36
}; node_117(){ required 67 59 60 34 115 116; }; node_118(){ required 67 59 42 37 }; node_117(){ required 67 59 60 34 115 116; }; node_118(){ required 67 59 42 37
}; node_119(){ required 67 59 69; }; node_120(){ required 67 59 34 51; } }; node_119(){ required 67 59 69; }; node_120(){ required 67 59 34 51; }
@ -220,9 +220,9 @@ required 67 64; }; node_126(){ oneormore 38; }; node_127(){ optional 126; }
node_128(){ required 67 65 127; }; node_129(){ required 67; }; node_130(){ node_128(){ required 67 65 127; }; node_129(){ required 67; }; node_130(){
either 73 78 81 84 85 86 87 89 90 91 95 97 101 102 107 108 111 112 114 117 118 119 120 121 122 124 125 128 129 either 73 78 81 84 85 86 87 89 90 91 95 97 101 102 107 108 111 112 114 117 118 119 120 121 122 124 125 128 129
}; node_131(){ required 130; }; cat <<<' docopt_exit() { }; node_131(){ required 130; }; cat <<<' docopt_exit() {
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1491}" >&2 [[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1501}" >&2
exit 1; }'; unset var___stack var___env var___skip_update var___debug \ exit 1; }'; unset var___skip_update var___env var___help var___stack \
var___help var___verbose var___skip_check var___branch var___status \ var___verbose var___branch var___debug var___skip_check var___status \
var___server var___type var___domain var___app_name var___pass var___secrets \ var___server var___type var___domain var___app_name var___pass var___secrets \
var___all var___update var___force var___volumes var___no_tty var___user \ var___all var___update var___force var___volumes var___no_tty var___user \
var___dev var__type_ var__app_ var__service_ var__src_ var__dst_ \ var___dev var__type_ var__app_ var__service_ var__src_ var__dst_ \
@ -232,32 +232,32 @@ var__subcommands_ var_app var_list var_ls var_new var_backup var_deploy \
var_check var_config var_cp var_logs var_ps var_restore var_rm var_delete \ var_check var_config var_cp var_logs var_ps var_restore var_rm var_delete \
var_run var_rollback var_secret var_generate var_insert var_undeploy \ var_run var_rollback var_secret var_generate var_insert var_undeploy \
var_server var_add var_init var_apps var_upgrade var_version var_help var_server var_add var_init var_apps var_upgrade var_version var_help
parse 131 "$@"; local prefix=${DOCOPT_PREFIX:-''}; unset "${prefix}__stack" \ parse 131 "$@"; local prefix=${DOCOPT_PREFIX:-''}
"${prefix}__env" "${prefix}__skip_update" "${prefix}__debug" "${prefix}__help" \ unset "${prefix}__skip_update" "${prefix}__env" "${prefix}__help" \
"${prefix}__verbose" "${prefix}__skip_check" "${prefix}__branch" \ "${prefix}__stack" "${prefix}__verbose" "${prefix}__branch" "${prefix}__debug" \
"${prefix}__status" "${prefix}__server" "${prefix}__type" "${prefix}__domain" \ "${prefix}__skip_check" "${prefix}__status" "${prefix}__server" \
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \ "${prefix}__type" "${prefix}__domain" "${prefix}__app_name" "${prefix}__pass" \
"${prefix}__update" "${prefix}__force" "${prefix}__volumes" \ "${prefix}__secrets" "${prefix}__all" "${prefix}__update" "${prefix}__force" \
"${prefix}__no_tty" "${prefix}__user" "${prefix}__dev" "${prefix}_type_" \ "${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__dev" \
"${prefix}_app_" "${prefix}_service_" "${prefix}_src_" "${prefix}_dst_" \ "${prefix}_type_" "${prefix}_app_" "${prefix}_service_" "${prefix}_src_" \
"${prefix}_backup_file_" "${prefix}_args_" "${prefix}_secret_" \ "${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
"${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" "${prefix}_command_" \ "${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \
"${prefix}_host_" "${prefix}_user_" "${prefix}_port_" "${prefix}_provider_" \ "${prefix}_command_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
"${prefix}_subcommands_" "${prefix}app" "${prefix}list" "${prefix}ls" \ "${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \
"${prefix}new" "${prefix}backup" "${prefix}deploy" "${prefix}check" \ "${prefix}ls" "${prefix}new" "${prefix}backup" "${prefix}deploy" \
"${prefix}config" "${prefix}cp" "${prefix}logs" "${prefix}ps" \ "${prefix}check" "${prefix}config" "${prefix}cp" "${prefix}logs" "${prefix}ps" \
"${prefix}restore" "${prefix}rm" "${prefix}delete" "${prefix}run" \ "${prefix}restore" "${prefix}rm" "${prefix}delete" "${prefix}run" \
"${prefix}rollback" "${prefix}secret" "${prefix}generate" "${prefix}insert" \ "${prefix}rollback" "${prefix}secret" "${prefix}generate" "${prefix}insert" \
"${prefix}undeploy" "${prefix}server" "${prefix}add" "${prefix}init" \ "${prefix}undeploy" "${prefix}server" "${prefix}add" "${prefix}init" \
"${prefix}apps" "${prefix}upgrade" "${prefix}version" "${prefix}help" "${prefix}apps" "${prefix}upgrade" "${prefix}version" "${prefix}help"
eval "${prefix}"'__stack=${var___stack:-}'
eval "${prefix}"'__env=${var___env:-}'
eval "${prefix}"'__skip_update=${var___skip_update:-false}' eval "${prefix}"'__skip_update=${var___skip_update:-false}'
eval "${prefix}"'__debug=${var___debug:-false}' eval "${prefix}"'__env=${var___env:-}'
eval "${prefix}"'__help=${var___help:-false}' eval "${prefix}"'__help=${var___help:-false}'
eval "${prefix}"'__stack=${var___stack:-}'
eval "${prefix}"'__verbose=${var___verbose:-false}' eval "${prefix}"'__verbose=${var___verbose:-false}'
eval "${prefix}"'__skip_check=${var___skip_check:-false}'
eval "${prefix}"'__branch=${var___branch:-}' eval "${prefix}"'__branch=${var___branch:-}'
eval "${prefix}"'__debug=${var___debug:-false}'
eval "${prefix}"'__skip_check=${var___skip_check:-false}'
eval "${prefix}"'__status=${var___status:-false}' eval "${prefix}"'__status=${var___status:-false}'
eval "${prefix}"'__server=${var___server:-}' eval "${prefix}"'__server=${var___server:-}'
eval "${prefix}"'__type=${var___type:-}' eval "${prefix}"'__type=${var___type:-}'
@ -314,20 +314,19 @@ eval "${prefix}"'upgrade=${var_upgrade:-false}'
eval "${prefix}"'version=${var_version:-false}' eval "${prefix}"'version=${var_version:-false}'
eval "${prefix}"'help=${var_help:-false}'; local docopt_i=1 eval "${prefix}"'help=${var_help:-false}'; local docopt_i=1
[[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do [[ $BASH_VERSION =~ ^4.3 ]] && docopt_i=2; for ((;docopt_i>0;docopt_i--)); do
declare -p "${prefix}__stack" "${prefix}__env" "${prefix}__skip_update" \ declare -p "${prefix}__skip_update" "${prefix}__env" "${prefix}__help" \
"${prefix}__debug" "${prefix}__help" "${prefix}__verbose" \ "${prefix}__stack" "${prefix}__verbose" "${prefix}__branch" "${prefix}__debug" \
"${prefix}__skip_check" "${prefix}__branch" "${prefix}__status" \ "${prefix}__skip_check" "${prefix}__status" "${prefix}__server" \
"${prefix}__server" "${prefix}__type" "${prefix}__domain" \ "${prefix}__type" "${prefix}__domain" "${prefix}__app_name" "${prefix}__pass" \
"${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \ "${prefix}__secrets" "${prefix}__all" "${prefix}__update" "${prefix}__force" \
"${prefix}__update" "${prefix}__force" "${prefix}__volumes" \ "${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__dev" \
"${prefix}__no_tty" "${prefix}__user" "${prefix}__dev" "${prefix}_type_" \ "${prefix}_type_" "${prefix}_app_" "${prefix}_service_" "${prefix}_src_" \
"${prefix}_app_" "${prefix}_service_" "${prefix}_src_" "${prefix}_dst_" \ "${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
"${prefix}_backup_file_" "${prefix}_args_" "${prefix}_secret_" \ "${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \
"${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" "${prefix}_command_" \ "${prefix}_command_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
"${prefix}_host_" "${prefix}_user_" "${prefix}_port_" "${prefix}_provider_" \ "${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \
"${prefix}_subcommands_" "${prefix}app" "${prefix}list" "${prefix}ls" \ "${prefix}ls" "${prefix}new" "${prefix}backup" "${prefix}deploy" \
"${prefix}new" "${prefix}backup" "${prefix}deploy" "${prefix}check" \ "${prefix}check" "${prefix}config" "${prefix}cp" "${prefix}logs" "${prefix}ps" \
"${prefix}config" "${prefix}cp" "${prefix}logs" "${prefix}ps" \
"${prefix}restore" "${prefix}rm" "${prefix}delete" "${prefix}run" \ "${prefix}restore" "${prefix}rm" "${prefix}delete" "${prefix}run" \
"${prefix}rollback" "${prefix}secret" "${prefix}generate" "${prefix}insert" \ "${prefix}rollback" "${prefix}secret" "${prefix}generate" "${prefix}insert" \
"${prefix}undeploy" "${prefix}server" "${prefix}add" "${prefix}init" \ "${prefix}undeploy" "${prefix}server" "${prefix}add" "${prefix}init" \
@ -1071,8 +1070,13 @@ POWERED BY
} }
sub_app_undeploy (){ sub_app_undeploy (){
FORCE_UNDEPLOY=$abra___force
warning "About to un-deploy $STACK_NAME from $SERVER" warning "About to un-deploy $STACK_NAME from $SERVER"
prompt_confirm
if [[ $FORCE_UNDEPLOY != "true" ]]; then
prompt_confirm
fi
docker stack rm "$STACK_NAME" docker stack rm "$STACK_NAME"
} }