diff --git a/plugins/00_dokku-standard/subcommands/urls b/plugins/00_dokku-standard/subcommands/urls index 8f94cbe0d..f71fed601 100755 --- a/plugins/00_dokku-standard/subcommands/urls +++ b/plugins/00_dokku-standard/subcommands/urls @@ -8,8 +8,7 @@ cmd-urls() { declare cmd="url" declare APP="$2" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" - + verify_app_name "$APP" get_app_urls "$@" } diff --git a/plugins/certs/subcommands/add b/plugins/certs/subcommands/add index 901c026a8..579afc757 100755 --- a/plugins/certs/subcommands/add +++ b/plugins/certs/subcommands/add @@ -34,7 +34,6 @@ cmd-certs-set() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" CRT_FILE="$2" KEY_FILE="$3" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$APP" local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" diff --git a/plugins/certs/subcommands/generate b/plugins/certs/subcommands/generate index 8e53b5c00..a8307ec05 100755 --- a/plugins/certs/subcommands/generate +++ b/plugins/certs/subcommands/generate @@ -9,7 +9,6 @@ cmd-certs-generate() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" DOMAIN="$2" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$APP" local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" diff --git a/plugins/certs/subcommands/remove b/plugins/certs/subcommands/remove index 717dc7e57..87e419b72 100755 --- a/plugins/certs/subcommands/remove +++ b/plugins/certs/subcommands/remove @@ -9,7 +9,6 @@ cmd-certs-remove() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$APP" local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" diff --git a/plugins/certs/subcommands/show b/plugins/certs/subcommands/show index 0f3577f58..417fd7689 100755 --- a/plugins/certs/subcommands/show +++ b/plugins/certs/subcommands/show @@ -10,7 +10,6 @@ cmd-certs-show() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" KEY_TYPE="$2" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$APP" local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" diff --git a/plugins/common/functions b/plugins/common/functions index 43fed2281..1481cb0f9 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -612,6 +612,7 @@ cmd-deploy() { declare APP="$1" IMAGE_TAG="$2" source "$PLUGIN_AVAILABLE_PATH/config/functions" + verify_app_name "$APP" local DOKKU_SCHEDULER=$(get_app_scheduler "$APP") plugn trigger scheduler-deploy "$DOKKU_SCHEDULER" "$APP" "$IMAGE_TAG" } diff --git a/plugins/docker-options/subcommands/clear b/plugins/docker-options/subcommands/clear index 66b331ac0..83c0501dd 100755 --- a/plugins/docker-options/subcommands/clear +++ b/plugins/docker-options/subcommands/clear @@ -10,7 +10,6 @@ cmd-docker-options-clear() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" PHASES="$2" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$APP" if [[ -z "$PHASES" ]]; then diff --git a/plugins/domains/subcommands/add b/plugins/domains/subcommands/add index 2178add1c..464b402ea 100755 --- a/plugins/domains/subcommands/add +++ b/plugins/domains/subcommands/add @@ -10,8 +10,8 @@ cmd-domains-add() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" DOMAIN_NAME="$2" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z "$DOMAIN_NAME" ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 $2 [ ...]" + verify_app_name "$APP" domains_add "$@" } diff --git a/plugins/domains/subcommands/clear b/plugins/domains/subcommands/clear index 965f14165..c0e7a6bce 100755 --- a/plugins/domains/subcommands/clear +++ b/plugins/domains/subcommands/clear @@ -10,7 +10,6 @@ cmd-domains-clear() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$APP" local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" diff --git a/plugins/domains/subcommands/disable b/plugins/domains/subcommands/disable index 0757a77fe..d0750a312 100755 --- a/plugins/domains/subcommands/disable +++ b/plugins/domains/subcommands/disable @@ -10,7 +10,7 @@ cmd-domains-disable() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" + verify_app_name "$APP" domains_disable "$APP" } diff --git a/plugins/domains/subcommands/enable b/plugins/domains/subcommands/enable index d4f641cb5..90336df4a 100755 --- a/plugins/domains/subcommands/enable +++ b/plugins/domains/subcommands/enable @@ -10,7 +10,7 @@ cmd-domains-enable() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" + verify_app_name "$APP" domains_enable "$APP" } diff --git a/plugins/domains/subcommands/remove b/plugins/domains/subcommands/remove index e9ee9837a..365ce7f80 100755 --- a/plugins/domains/subcommands/remove +++ b/plugins/domains/subcommands/remove @@ -10,8 +10,8 @@ cmd-domains-remove() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" DOMAIN_NAME="$2" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z "$DOMAIN_NAME" ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 $2 [ ...]" + verify_app_name "$APP" domains_remove "$@" } diff --git a/plugins/domains/subcommands/set b/plugins/domains/subcommands/set index fdda804fa..fc50cdd3a 100755 --- a/plugins/domains/subcommands/set +++ b/plugins/domains/subcommands/set @@ -10,8 +10,8 @@ cmd-domains-set() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" DOMAIN_NAME="$2" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z "$DOMAIN_NAME" ]] && dokku_log_fail "Please specify a domain name. Usage: dokku $1 $2 [ ...]" + verify_app_name "$APP" domains_set "$@" } diff --git a/plugins/domains/subcommands/setup b/plugins/domains/subcommands/setup index 007ce1ec8..6458bf6c4 100755 --- a/plugins/domains/subcommands/setup +++ b/plugins/domains/subcommands/setup @@ -10,7 +10,7 @@ cmd-domains-setup() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" + verify_app_name "$APP" domains_setup "$APP" } diff --git a/plugins/git/subcommands/initialize b/plugins/git/subcommands/initialize index e5ed2cfbf..fc2d85dbf 100755 --- a/plugins/git/subcommands/initialize +++ b/plugins/git/subcommands/initialize @@ -10,7 +10,7 @@ cmd-git-initialize() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" - is_valid_app_name "$APP" + verify_app_name "$APP" dokku_log_info1_quiet "Initializing git repository for $APP" fn-git-create-hook "$APP" } diff --git a/plugins/git/subcommands/set b/plugins/git/subcommands/set index f80d214fd..ea486621e 100755 --- a/plugins/git/subcommands/set +++ b/plugins/git/subcommands/set @@ -10,8 +10,8 @@ cmd-git-set() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" KEY="$2" VALUE="$3" local VALID_KEYS=("deploy-branch" "keep-git-dir" "rev-env-var") + verify_app_name "$APP" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z "$KEY" ]] && dokku_log_fail "No key specified" if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then diff --git a/plugins/nginx-vhosts/command-functions b/plugins/nginx-vhosts/command-functions index 1fda16313..7a648d60d 100755 --- a/plugins/nginx-vhosts/command-functions +++ b/plugins/nginx-vhosts/command-functions @@ -112,5 +112,6 @@ cmd-nginx-validate-config() { fi declare APP="$1" FLAG="$2" + verify_app_name "$APP" validate_nginx "$APP" "$FLAG" } diff --git a/plugins/nginx-vhosts/subcommands/access-logs b/plugins/nginx-vhosts/subcommands/access-logs index 20413d51f..d46a1f42f 100755 --- a/plugins/nginx-vhosts/subcommands/access-logs +++ b/plugins/nginx-vhosts/subcommands/access-logs @@ -6,9 +6,9 @@ source "$PLUGIN_AVAILABLE_PATH/nginx-vhosts/functions" cmd-nginx-logs() { declare desc="display app nginx logs from command line" - declare cmd="$1" + declare cmd="$1" APP="$2" - [[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on" + verify_app_name "$APP" nginx_logs "$@" } diff --git a/plugins/nginx-vhosts/subcommands/build-config b/plugins/nginx-vhosts/subcommands/build-config index efcbb3b35..595ce3e07 100755 --- a/plugins/nginx-vhosts/subcommands/build-config +++ b/plugins/nginx-vhosts/subcommands/build-config @@ -8,9 +8,9 @@ cmd-nginx-build-config() { declare cmd="nginx:build-config" [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" + verify_app_name "$APP" dokku_log_warn "Deprecated: Please use proxy:build-config" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" local PROXY_APP_TYPE PROXY_APP_TYPE="$(plugn trigger proxy-type "$APP")" diff --git a/plugins/nginx-vhosts/subcommands/set b/plugins/nginx-vhosts/subcommands/set index c85f5ab22..5066e860e 100755 --- a/plugins/nginx-vhosts/subcommands/set +++ b/plugins/nginx-vhosts/subcommands/set @@ -10,8 +10,8 @@ cmd-nginx-set() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" KEY="$2" VALUE="$3" local VALID_KEYS=("access-log-format" "access-log-path" "bind-address-ipv4" "bind-address-ipv6" "disable-custom-config" "error-log-path" "hsts" "hsts-include-subdomains" "hsts-preload" "hsts-max-age" "proxy-read-timeout" "proxy-buffer-size" "proxy-buffering" "proxy-buffers" "proxy-busy-buffers-size") + verify_app_name "$APP" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z "$KEY" ]] && dokku_log_fail "No key specified" if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then diff --git a/plugins/scheduler-docker-local/subcommands/set b/plugins/scheduler-docker-local/subcommands/set index 522162a6a..438d7013f 100755 --- a/plugins/scheduler-docker-local/subcommands/set +++ b/plugins/scheduler-docker-local/subcommands/set @@ -10,8 +10,8 @@ cmd-scheduler-docker-local-set() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" KEY="$2" VALUE="$3" local VALID_KEYS=("disable-chown") + verify_app_name "$APP" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" [[ -z "$KEY" ]] && dokku_log_fail "No key specified" if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then diff --git a/plugins/storage/internal-functions b/plugins/storage/internal-functions index 31c292790..6215b09f8 100755 --- a/plugins/storage/internal-functions +++ b/plugins/storage/internal-functions @@ -81,9 +81,8 @@ cmd-storage-list() { declare cmd="storage:list" [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" - local passed_phases="deploy" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" + verify_app_name "$APP" dokku_log_quiet "$APP volume bind-mounts:" get_bind_mounts "$(get_phase_file_path "$passed_phases")" diff --git a/plugins/storage/subcommands/mount b/plugins/storage/subcommands/mount index be6e91ea5..27ad9a06c 100755 --- a/plugins/storage/subcommands/mount +++ b/plugins/storage/subcommands/mount @@ -12,9 +12,6 @@ cmd-storage-mount() { declare APP="$1" MOUNT_PATH="$2" local passed_phases=(deploy run) - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" - [[ -z "$MOUNT_PATH" ]] && dokku_log_fail "Please specify two paths delimited by colon." - verify_app_name "$APP" verify_paths "$MOUNT_PATH" check_if_path_exists "$MOUNT_PATH" "$(get_phase_file_path "${passed_phases[@]}")" && dokku_log_fail "Mount path already exists." diff --git a/plugins/storage/subcommands/unmount b/plugins/storage/subcommands/unmount index 5fb58010b..941060302 100755 --- a/plugins/storage/subcommands/unmount +++ b/plugins/storage/subcommands/unmount @@ -12,8 +12,6 @@ cmd-storage-unmount() { declare APP="$1" MOUNT_PATH="$2" local passed_phases=(deploy run) - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" - [[ -z "$MOUNT_PATH" ]] && dokku_log_fail "Please specify two paths delimited by colon." verify_app_name "$APP" verify_paths "$MOUNT_PATH" check_if_path_exists "$MOUNT_PATH" "$(get_phase_file_path "${passed_phases[@]}")" || dokku_log_fail "Mount path does not exist." diff --git a/plugins/tags/subcommands/create b/plugins/tags/subcommands/create index ea49d1506..14f34c46b 100755 --- a/plugins/tags/subcommands/create +++ b/plugins/tags/subcommands/create @@ -10,7 +10,6 @@ cmd-tags-create() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" IMAGE_TAG="$2" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$APP" local IMAGE_REPO=$(get_app_image_repo "$APP") diff --git a/plugins/tags/subcommands/default b/plugins/tags/subcommands/default index e740f5983..195feae15 100755 --- a/plugins/tags/subcommands/default +++ b/plugins/tags/subcommands/default @@ -9,7 +9,6 @@ cmd-tags-default() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$APP" local IMAGE_REPO=$(get_app_image_repo "$APP") diff --git a/plugins/tags/subcommands/deploy b/plugins/tags/subcommands/deploy index e78e86202..61987b384 100755 --- a/plugins/tags/subcommands/deploy +++ b/plugins/tags/subcommands/deploy @@ -9,7 +9,6 @@ cmd-tags-deploy() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" IMAGE_TAG="$2" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$APP" local IMAGE="$(get_app_image_name "$APP" "$IMAGE_TAG")" diff --git a/plugins/tags/subcommands/destroy b/plugins/tags/subcommands/destroy index 7a935948e..7f0cabfe3 100755 --- a/plugins/tags/subcommands/destroy +++ b/plugins/tags/subcommands/destroy @@ -10,7 +10,6 @@ cmd-tags-destroy() { [[ "$1" == "$cmd" ]] && shift 1 declare APP="$1" IMAGE_TAG="$2" - [[ -z "$APP" ]] && dokku_log_fail "Please specify an app to run the command on" verify_app_name "$APP" local IMAGE_REPO=$(get_app_image_repo "$APP")