Replace all --force usage with --no-prompt

Closes coop-cloud/abra#118.
This commit is contained in:
decentral1se 2021-03-25 22:47:59 +01:00
parent c315ebe319
commit 07e3678c78
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A
2 changed files with 98 additions and 93 deletions

View File

@ -21,6 +21,7 @@
- Add docker version check (guestimating < v20 is a bad idea) ([#15](https://git.autonomic.zone/coop-cloud/abra/issues/15)) - Add docker version check (guestimating < v20 is a bad idea) ([#15](https://git.autonomic.zone/coop-cloud/abra/issues/15))
- Fix git branch handling when not passing `-b <branch>` ([#122](https://git.autonomic.zone/coop-cloud/abra/issues/122)) - Fix git branch handling when not passing `-b <branch>` ([#122](https://git.autonomic.zone/coop-cloud/abra/issues/122))
- Add work-around to correctly git clone non-master default branch app repositories ([#122](https://git.autonomic.zone/coop-cloud/abra/issues/122)) - Add work-around to correctly git clone non-master default branch app repositories ([#122](https://git.autonomic.zone/coop-cloud/abra/issues/122))
- Replace `--force` with a global `--no-prompt` for avoiding interactive questions ([#118](https://git.autonomic.zone/coop-cloud/abra/issues/118))
# abra 0.6.0 (2021-03-17) # abra 0.6.0 (2021-03-17)

190
abra
View File

@ -18,7 +18,7 @@ Usage:
abra [options] app (list|ls) [--status] [--server=<server>] [--type=<type>] abra [options] app (list|ls) [--status] [--server=<server>] [--type=<type>]
abra [options] app new [--server=<server>] [--domain=<domain>] [--app-name=<app_name>] [--pass] [--secrets] <type> abra [options] app new [--server=<server>] [--domain=<domain>] [--app-name=<app_name>] [--pass] [--secrets] <type>
abra [options] app <app> backup (<service>|--all) abra [options] app <app> backup (<service>|--all)
abra [options] app <app> deploy [--update] [--force] abra [options] app <app> deploy [--update]
abra [options] app <app> check abra [options] app <app> check
abra [options] app <app> version abra [options] app <app> version
abra [options] app <app> config abra [options] app <app> config
@ -26,14 +26,14 @@ Usage:
abra [options] app <app> logs [<service>] abra [options] app <app> logs [<service>]
abra [options] app <app> ps abra [options] app <app> ps
abra [options] app <app> restore (<service>|--all) abra [options] app <app> restore (<service>|--all)
abra [options] app <app> (rm|delete) [--force] [--volumes] [--secrets] abra [options] app <app> (rm|delete) [--volumes] [--secrets]
abra [options] app <app> restore <service> [<backup file>] abra [options] app <app> restore <service> [<backup file>]
abra [options] app <app> run [--no-tty] [--user=<user>] <service> <args>... abra [options] app <app> run [--no-tty] [--user=<user>] <service> <args>...
abra [options] app <app> rollback <service> abra [options] app <app> rollback <service>
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]
abra [options] app <app> undeploy [--force] abra [options] app <app> undeploy
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>
@ -55,6 +55,7 @@ Options:
-v, --verbose Show INFO messages -v, --verbose Show INFO messages
-d, --debug Show DEBUG messages -d, --debug Show DEBUG messages
-b, --branch=<branch> Git branch to use while cloning app repos -b, --branch=<branch> Git branch to use while cloning app repos
-n, --no-prompt Don't prompt for input and run non-interactively
See 'abra help <subcommands>...' to read about a specific subcommand. See 'abra help <subcommands>...' to read about a specific subcommand.
" "
@ -158,20 +159,20 @@ 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:2072} printf -- "exit %d\n" "$1"; exit "$1"; }; set -e; trimmed_doc=${DOC:1:2105}
usage=${DOC:40:1536}; digest=9142c usage=${DOC:40:1496}; digest=664f6
shorts=(-U -v -s -h -C -b -d -e '' '' '' '' '' '' '' '' '' '' '' '' '' '') shorts=(-U -s -b -C -e -h -v -n -d '' '' '' '' '' '' '' '' '' '' '' '' '')
longs=(--skip-update --verbose --stack --help --skip-check --branch --debug --env --status --server --type --domain --app-name --pass --secrets --all --update --force --volumes --no-tty --user --dev) longs=(--skip-update --stack --branch --skip-check --env --help --verbose --no-prompt --debug --status --server --type --domain --app-name --pass --secrets --all --update --volumes --no-tty --user --dev)
argcounts=(0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 0 0 0 0 1 0); node_0(){ argcounts=(0 1 1 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 0); node_0(){
switch __skip_update 0; }; node_1(){ switch __verbose 1; }; node_2(){ switch __skip_update 0; }; node_1(){ value __stack 1; }; node_2(){
value __stack 2; }; node_3(){ switch __help 3; }; node_4(){ value __branch 2; }; node_3(){ switch __skip_check 3; }; node_4(){ value __env 4
switch __skip_check 4; }; node_5(){ value __branch 5; }; node_6(){ }; node_5(){ switch __help 5; }; node_6(){ switch __verbose 6; }; node_7(){
switch __debug 6; }; node_7(){ value __env 7; }; node_8(){ switch __status 8; } switch __no_prompt 7; }; node_8(){ switch __debug 8; }; node_9(){
node_9(){ value __server 9; }; node_10(){ value __type 10; }; node_11(){ switch __status 9; }; node_10(){ value __server 10; }; node_11(){
value __domain 11; }; node_12(){ value __app_name 12; }; node_13(){ value __type 11; }; node_12(){ value __domain 12; }; node_13(){
switch __pass 13; }; node_14(){ switch __secrets 14; }; node_15(){ value __app_name 13; }; node_14(){ switch __pass 14; }; node_15(){
switch __all 15; }; node_16(){ switch __update 16; }; node_17(){ switch __secrets 15; }; node_16(){ switch __all 16; }; node_17(){
switch __force 17; }; node_18(){ switch __volumes 18; }; node_19(){ switch __update 17; }; node_18(){ switch __volumes 18; }; node_19(){
switch __no_tty 19; }; node_20(){ value __user 20; }; node_21(){ switch __dev 21 switch __no_tty 19; }; node_20(){ value __user 20; }; node_21(){ switch __dev 21
}; node_22(){ value _type_ a; }; node_23(){ value _app_ a; }; node_24(){ }; node_22(){ value _type_ a; }; node_23(){ value _app_ a; }; node_24(){
value _service_ a; }; node_25(){ value _src_ a; }; node_26(){ value _dst_ a; } value _service_ a; }; node_25(){ value _src_ a; }; node_26(){ value _dst_ a; }
@ -191,57 +192,57 @@ node_56(){ _command secret; }; node_57(){ _command generate; }; node_58(){
_command insert; }; node_59(){ _command undeploy; }; node_60(){ _command server _command insert; }; node_59(){ _command undeploy; }; node_60(){ _command server
}; node_61(){ _command add; }; node_62(){ _command init; }; node_63(){ }; node_61(){ _command add; }; node_62(){ _command init; }; node_63(){
_command apps; }; node_64(){ _command upgrade; }; node_65(){ _command help; } _command apps; }; node_64(){ _command upgrade; }; node_65(){ _command help; }
node_66(){ optional 0 1 2 3 4 5 6 7; }; node_67(){ optional 66; }; node_68(){ node_66(){ optional 0 1 2 3 4 5 6 7 8; }; node_67(){ optional 66; }; node_68(){
either 40 41; }; node_69(){ required 68; }; node_70(){ optional 8; }; node_71(){ either 40 41; }; node_69(){ required 68; }; node_70(){ optional 9; }; node_71(){
optional 9; }; node_72(){ optional 10; }; node_73(){ required 67 39 69 70 71 72 optional 10; }; node_72(){ optional 11; }; node_73(){ required 67 39 69 70 71 72
}; node_74(){ optional 11; }; node_75(){ optional 12; }; node_76(){ optional 13 }; node_74(){ optional 12; }; node_75(){ optional 13; }; node_76(){ optional 14
}; node_77(){ optional 14; }; node_78(){ required 67 39 42 71 74 75 76 77 22; } }; node_77(){ optional 15; }; node_78(){ required 67 39 42 71 74 75 76 77 22; }
node_79(){ either 24 15; }; node_80(){ required 79; }; node_81(){ node_79(){ either 24 16; }; node_80(){ required 79; }; node_81(){
required 67 39 23 43 80; }; node_82(){ optional 16; }; node_83(){ optional 17; } required 67 39 23 43 80; }; node_82(){ optional 17; }; node_83(){
node_84(){ required 67 39 23 44 82 83; }; node_85(){ required 67 39 23 45; } required 67 39 23 44 82; }; node_84(){ required 67 39 23 45; }; node_85(){
node_86(){ required 67 39 23 46; }; node_87(){ required 67 39 23 47; } required 67 39 23 46; }; node_86(){ required 67 39 23 47; }; node_87(){
node_88(){ required 67 39 23 48 25 26; }; node_89(){ optional 24; }; node_90(){ required 67 39 23 48 25 26; }; node_88(){ optional 24; }; node_89(){
required 67 39 23 49 89; }; node_91(){ required 67 39 23 50; }; node_92(){ required 67 39 23 49 88; }; node_90(){ required 67 39 23 50; }; node_91(){
required 67 39 23 51 80; }; node_93(){ either 52 53; }; node_94(){ required 93 required 67 39 23 51 80; }; node_92(){ either 52 53; }; node_93(){ required 92
}; node_95(){ optional 18; }; node_96(){ required 67 39 23 94 83 95 77; } }; node_94(){ optional 18; }; node_95(){ required 67 39 23 93 94 77; }
node_97(){ optional 27; }; node_98(){ required 67 39 23 51 24 97; }; node_99(){ node_96(){ optional 27; }; node_97(){ required 67 39 23 51 24 96; }; node_98(){
optional 19; }; node_100(){ optional 20; }; node_101(){ oneormore 28; } optional 19; }; node_99(){ optional 20; }; node_100(){ oneormore 28; }
node_102(){ required 67 39 23 54 99 100 24 101; }; node_103(){ node_101(){ required 67 39 23 54 98 99 24 100; }; node_102(){
required 67 39 23 55 24; }; node_104(){ required 29 30; }; node_105(){ required 67 39 23 55 24; }; node_103(){ required 29 30; }; node_104(){
either 104 15; }; node_106(){ required 105; }; node_107(){ optional 31; } either 103 16; }; node_105(){ required 104; }; node_106(){ optional 31; }
node_108(){ required 67 39 23 56 57 106 107 76; }; node_109(){ node_107(){ required 67 39 23 56 57 105 106 76; }; node_108(){
required 67 39 23 56 58 29 30 32 76; }; node_110(){ either 29 15; }; node_111(){ required 67 39 23 56 58 29 30 32 76; }; node_109(){ either 29 16; }; node_110(){
required 110; }; node_112(){ required 67 39 23 56 94 111 76 83; }; node_113(){ required 109; }; node_111(){ required 67 39 23 56 93 110 76; }; node_112(){
required 67 39 23 59 83; }; node_114(){ optional 101; }; node_115(){ required 67 39 23 59; }; node_113(){ optional 100; }; node_114(){
required 67 39 23 33 114; }; node_116(){ optional 35; }; node_117(){ optional 36 required 67 39 23 33 113; }; node_115(){ optional 35; }; node_116(){ optional 36
}; node_118(){ required 67 60 61 34 116 117; }; node_119(){ required 67 60 42 37 }; node_117(){ required 67 60 61 34 115 116; }; node_118(){ required 67 60 42 37
}; node_120(){ required 67 60 69; }; node_121(){ required 67 60 34 52; } }; node_119(){ required 67 60 69; }; node_120(){ required 67 60 34 52; }
node_122(){ required 67 60 34 62; }; node_123(){ required 67 60 34 63 70; } node_121(){ required 67 60 34 62; }; node_122(){ required 67 60 34 63 70; }
node_124(){ optional 21; }; node_125(){ required 67 64 124; }; node_126(){ node_123(){ optional 21; }; node_124(){ required 67 64 123; }; node_125(){
required 67 46; }; node_127(){ oneormore 38; }; node_128(){ optional 127; } required 67 46; }; node_126(){ oneormore 38; }; node_127(){ optional 126; }
node_129(){ required 67 65 128; }; node_130(){ required 67; }; node_131(){ node_128(){ required 67 65 127; }; node_129(){ required 67; }; node_130(){
either 73 78 81 84 85 86 87 88 90 91 92 96 98 102 103 108 109 112 113 115 118 119 120 121 122 123 125 126 129 130 either 73 78 81 83 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_132(){ required 131; }; cat <<<' docopt_exit() { }; node_131(){ required 130; }; cat <<<' docopt_exit() {
[[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1536}" >&2 [[ -n $1 ]] && printf "%s\n" "$1" >&2; printf "%s\n" "${DOC:40:1496}" >&2
exit 1; }'; unset var___skip_update var___verbose var___stack var___help \ exit 1; }'; unset var___skip_update var___stack var___branch var___skip_check \
var___skip_check var___branch var___debug var___env var___status var___server \ var___env var___help var___verbose var___no_prompt var___debug var___status \
var___type var___domain var___app_name var___pass var___secrets var___all \ var___server var___type var___domain var___app_name var___pass var___secrets \
var___update var___force var___volumes var___no_tty var___user var___dev \ var___all var___update var___volumes var___no_tty var___user var___dev \
var__type_ var__app_ var__service_ var__src_ var__dst_ var__backup_file_ \ var__type_ var__app_ var__service_ var__src_ var__dst_ var__backup_file_ \
var__args_ var__secret_ var__version_ var__cmd_ var__data_ var__command_ \ var__args_ var__secret_ var__version_ var__cmd_ var__data_ var__command_ \
var__host_ var__user_ var__port_ var__provider_ var__subcommands_ var_app \ var__host_ var__user_ var__port_ var__provider_ var__subcommands_ var_app \
var_list var_ls var_new var_backup var_deploy var_check var_version var_config \ var_list var_ls var_new var_backup var_deploy var_check var_version var_config \
var_cp var_logs var_ps var_restore var_rm var_delete var_run var_rollback \ 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_server var_add var_init \ var_secret var_generate var_insert var_undeploy var_server var_add var_init \
var_apps var_upgrade var_help; parse 132 "$@"; local prefix=${DOCOPT_PREFIX:-''} var_apps var_upgrade var_help; parse 131 "$@"; local prefix=${DOCOPT_PREFIX:-''}
unset "${prefix}__skip_update" "${prefix}__verbose" "${prefix}__stack" \ unset "${prefix}__skip_update" "${prefix}__stack" "${prefix}__branch" \
"${prefix}__help" "${prefix}__skip_check" "${prefix}__branch" \ "${prefix}__skip_check" "${prefix}__env" "${prefix}__help" \
"${prefix}__debug" "${prefix}__env" "${prefix}__status" "${prefix}__server" \ "${prefix}__verbose" "${prefix}__no_prompt" "${prefix}__debug" \
"${prefix}__type" "${prefix}__domain" "${prefix}__app_name" "${prefix}__pass" \ "${prefix}__status" "${prefix}__server" "${prefix}__type" "${prefix}__domain" \
"${prefix}__secrets" "${prefix}__all" "${prefix}__update" "${prefix}__force" \ "${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
"${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__dev" \ "${prefix}__update" "${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" \
"${prefix}_type_" "${prefix}_app_" "${prefix}_service_" "${prefix}_src_" \ "${prefix}__dev" "${prefix}_type_" "${prefix}_app_" "${prefix}_service_" \
"${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \ "${prefix}_src_" "${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
"${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \ "${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \
"${prefix}_command_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \ "${prefix}_command_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
"${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \ "${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \
@ -252,13 +253,14 @@ unset "${prefix}__skip_update" "${prefix}__verbose" "${prefix}__stack" \
"${prefix}generate" "${prefix}insert" "${prefix}undeploy" "${prefix}server" \ "${prefix}generate" "${prefix}insert" "${prefix}undeploy" "${prefix}server" \
"${prefix}add" "${prefix}init" "${prefix}apps" "${prefix}upgrade" \ "${prefix}add" "${prefix}init" "${prefix}apps" "${prefix}upgrade" \
"${prefix}help"; eval "${prefix}"'__skip_update=${var___skip_update:-false}' "${prefix}help"; eval "${prefix}"'__skip_update=${var___skip_update:-false}'
eval "${prefix}"'__verbose=${var___verbose:-false}'
eval "${prefix}"'__stack=${var___stack:-}' eval "${prefix}"'__stack=${var___stack:-}'
eval "${prefix}"'__help=${var___help:-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}"'__env=${var___env:-}' eval "${prefix}"'__env=${var___env:-}'
eval "${prefix}"'__help=${var___help:-false}'
eval "${prefix}"'__verbose=${var___verbose:-false}'
eval "${prefix}"'__no_prompt=${var___no_prompt:-false}'
eval "${prefix}"'__debug=${var___debug:-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:-}'
@ -268,7 +270,6 @@ eval "${prefix}"'__pass=${var___pass:-false}'
eval "${prefix}"'__secrets=${var___secrets:-false}' eval "${prefix}"'__secrets=${var___secrets:-false}'
eval "${prefix}"'__all=${var___all:-false}' eval "${prefix}"'__all=${var___all:-false}'
eval "${prefix}"'__update=${var___update:-false}' eval "${prefix}"'__update=${var___update:-false}'
eval "${prefix}"'__force=${var___force:-false}'
eval "${prefix}"'__volumes=${var___volumes:-false}' eval "${prefix}"'__volumes=${var___volumes:-false}'
eval "${prefix}"'__no_tty=${var___no_tty:-false}' eval "${prefix}"'__no_tty=${var___no_tty:-false}'
eval "${prefix}"'__user=${var___user:-}' eval "${prefix}"'__user=${var___user:-}'
@ -315,14 +316,14 @@ eval "${prefix}"'apps=${var_apps:-false}'
eval "${prefix}"'upgrade=${var_upgrade:-false}' eval "${prefix}"'upgrade=${var_upgrade:-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}__skip_update" "${prefix}__verbose" "${prefix}__stack" \ declare -p "${prefix}__skip_update" "${prefix}__stack" "${prefix}__branch" \
"${prefix}__help" "${prefix}__skip_check" "${prefix}__branch" \ "${prefix}__skip_check" "${prefix}__env" "${prefix}__help" \
"${prefix}__debug" "${prefix}__env" "${prefix}__status" "${prefix}__server" \ "${prefix}__verbose" "${prefix}__no_prompt" "${prefix}__debug" \
"${prefix}__type" "${prefix}__domain" "${prefix}__app_name" "${prefix}__pass" \ "${prefix}__status" "${prefix}__server" "${prefix}__type" "${prefix}__domain" \
"${prefix}__secrets" "${prefix}__all" "${prefix}__update" "${prefix}__force" \ "${prefix}__app_name" "${prefix}__pass" "${prefix}__secrets" "${prefix}__all" \
"${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" "${prefix}__dev" \ "${prefix}__update" "${prefix}__volumes" "${prefix}__no_tty" "${prefix}__user" \
"${prefix}_type_" "${prefix}_app_" "${prefix}_service_" "${prefix}_src_" \ "${prefix}__dev" "${prefix}_type_" "${prefix}_app_" "${prefix}_service_" \
"${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \ "${prefix}_src_" "${prefix}_dst_" "${prefix}_backup_file_" "${prefix}_args_" \
"${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \ "${prefix}_secret_" "${prefix}_version_" "${prefix}_cmd_" "${prefix}_data_" \
"${prefix}_command_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \ "${prefix}_command_" "${prefix}_host_" "${prefix}_user_" "${prefix}_port_" \
"${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \ "${prefix}_provider_" "${prefix}_subcommands_" "${prefix}app" "${prefix}list" \
@ -560,7 +561,7 @@ output_version_summary() {
echo " Versions:" echo " Versions:"
CONSENT_TO_UPDATE=$abra___update CONSENT_TO_UPDATE=$abra___update
FORCE_DEPLOY=$abra___force NON_INTERACTIVE=$abra___no_prompt
local -a IS_AN_UPDATE="false" local -a IS_AN_UPDATE="false"
local -a UNABLE_TO_DETECT="false" local -a UNABLE_TO_DETECT="false"
@ -621,10 +622,10 @@ output_version_summary() {
exit 0 exit 0
fi fi
if [[ $IS_AN_UPDATE == "true" ]] && [[ $FORCE_DEPLOY != "true" ]]; then if [[ $IS_AN_UPDATE == "true" ]] && [[ $NON_INTERACTIVE == "false" ]]; then
require_consent_for_update require_consent_for_update
else else
if [[ ! $UNABLE_TO_DETECT == "true" ]] && [[ $FORCE_DEPLOY != "true" ]] && [[ ! $UNDEPLOYED_STATE == "true" ]]; then if [[ ! $UNABLE_TO_DETECT == "true" ]] && [[ $NON_INTERACTIVE == "false" ]] && [[ ! $UNDEPLOYED_STATE == "true" ]]; then
success "Nothing to deploy, you're on latest (use --force to re-deploy anyway)" success "Nothing to deploy, you're on latest (use --force to re-deploy anyway)"
exit 0 exit 0
fi fi
@ -1097,7 +1098,7 @@ sub_app_deploy (){
require_yq require_yq
require_app_latest "$TYPE" require_app_latest "$TYPE"
FORCE_DEPLOY=$abra___force NON_INTERACTIVE=$abra___no_prompt
echo "Deployment overview:" echo "Deployment overview:"
echo " Server: $(tput setaf 4)${SERVER}$(tput sgr0)" echo " Server: $(tput setaf 4)${SERVER}$(tput sgr0)"
@ -1121,7 +1122,7 @@ sub_app_deploy (){
output_version_summary output_version_summary
if [[ $FORCE_DEPLOY != "true" ]]; then if [[ $NON_INTERACTIVE == "false" ]]; then
prompt_confirm prompt_confirm
fi fi
@ -1154,11 +1155,11 @@ POWERED BY
} }
sub_app_undeploy (){ sub_app_undeploy (){
FORCE_UNDEPLOY=$abra___force NON_INTERACTIVE=$abra___no_prompt
warning "About to un-deploy $STACK_NAME from $SERVER" warning "About to un-deploy $STACK_NAME from $SERVER"
if [[ $FORCE_UNDEPLOY != "true" ]]; then if [[ $NON_INTERACTIVE == "false" ]]; then
prompt_confirm prompt_confirm
fi fi
@ -1288,7 +1289,9 @@ POWERED BY
} }
sub_app_delete (){ sub_app_delete (){
if [ "$abra___force" != "true" ]; then NON_INTERACTIVE=$abra___no_prompt
if [ "$NON_INTERACTIVE" == "false" ]; then
warning "About to delete $ENV_FILE" warning "About to delete $ENV_FILE"
prompt_confirm prompt_confirm
fi fi
@ -1298,7 +1301,7 @@ sub_app_delete (){
if [ "$abra___volumes" = "true" ]; then if [ "$abra___volumes" = "true" ]; then
volumes="$(docker volume ls --filter "name=${STACK_NAME}" --quiet)" volumes="$(docker volume ls --filter "name=${STACK_NAME}" --quiet)"
if [ "$abra___force" != "true" ] && [ "$abra___volumes" = "true" ]; then if [ "$NON_INTERACTIVE" == "false" ] && [ "$abra___volumes" = "true" ]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
warning "SCARY: About to remove all volumes associated with ${STACK_NAME}: $(echo $volumes | tr -d '\n')" warning "SCARY: About to remove all volumes associated with ${STACK_NAME}: $(echo $volumes | tr -d '\n')"
@ -1312,7 +1315,7 @@ sub_app_delete (){
if [ "$abra___secrets" = "true" ]; then if [ "$abra___secrets" = "true" ]; then
secrets="$(docker secret ls --filter "name=${STACK_NAME}" --quiet)" secrets="$(docker secret ls --filter "name=${STACK_NAME}" --quiet)"
if [ "$abra___force" != "true" ] && [ "$abra___secrets" = "true" ]; then if [ "$NON_INTERACTIVE" == "false" ] && [ "$abra___secrets" = "true" ]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
warning "SCARY: About to remove all secrets associated with ${STACK_NAME}: $(echo $secrets | tr -d '\n')" warning "SCARY: About to remove all secrets associated with ${STACK_NAME}: $(echo $secrets | tr -d '\n')"
@ -1379,6 +1382,8 @@ POWERED BY
} }
sub_app_secret_delete(){ sub_app_secret_delete(){
NON_INTERACTIVE=$abra___no_prompt
# if --all is provided then $abra__secret_ will be blank and this will work # if --all is provided then $abra__secret_ will be blank and this will work
# auto-magically # auto-magically
NAMES=$(docker secret ls --filter "name=${STACK_NAME}_${abra__secret_}" --format "{{.Name}}") NAMES=$(docker secret ls --filter "name=${STACK_NAME}_${abra__secret_}" --format "{{.Name}}")
@ -1387,7 +1392,7 @@ sub_app_secret_delete(){
error "Could not find any secrets under ${STACK_NAME}_${abra__secret_}" error "Could not find any secrets under ${STACK_NAME}_${abra__secret_}"
fi fi
if [ "$abra___force" != "true" ]; then if [ "$NON_INTERACTIVE" == "false" ]; then
warning "About to delete $(echo "$NAMES" | paste -d "")" warning "About to delete $(echo "$NAMES" | paste -d "")"
prompt_confirm prompt_confirm
fi fi
@ -1904,12 +1909,11 @@ abra() {
declare abra___stack abra___env abra__command_ abra__args_ \ declare abra___stack abra___env abra__command_ abra__args_ \
abra__secret_ abra__version_ abra__data_ abra___user abra__host_ \ abra__secret_ abra__version_ abra__data_ abra___user abra__host_ \
abra__type_ abra__port_ abra__user_ abra__service_ abra__src_ abra__dst_ \ abra__type_ abra__port_ abra__user_ abra__service_ abra__src_ abra__dst_ \
abra___server abra___domain abra___force abra___pass \ abra___server abra___domain abra___pass abra___secrets abra___status \
abra___secrets abra___status abra___no_tty abra___app_name \ abra___no_tty abra___app_name abra__subcommands_ abra___skip_update \
abra__subcommands_ abra___skip_update abra___skip_check \ abra___skip_check abra__backup_file_ abra___verbose abra___debug \
abra__backup_file_ abra___verbose abra___debug abra___help \ abra___help abra___branch abra___volumes abra__provider_ abra___type \
abra___branch abra___volumes abra__provider_ abra___type \ abra___dev abra___update abra___no_prompt
abra___dev abra___update
if ! type tput > /dev/null 2>&1; then if ! type tput > /dev/null 2>&1; then
tput() { tput() {