From 08fdfd1e3872d45e00c127b9d773d8173190093e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 25 Dec 2020 00:14:57 -0500 Subject: [PATCH] feat: drop internal calls to verify_app_name --- plugins/builder-herokuish/pre-build-buildpack | 1 - plugins/certs/functions | 2 -- plugins/checks/functions | 2 -- plugins/common/functions | 12 ------------ plugins/config/docker-args-deploy | 1 - plugins/domains/functions | 11 ----------- plugins/git/functions | 1 - plugins/nginx-vhosts/functions | 5 ----- plugins/nginx-vhosts/proxy-disable | 1 - plugins/nginx-vhosts/proxy-enable | 1 - plugins/scheduler-docker-local/scheduler-deploy | 1 - plugins/tar/functions | 1 - 12 files changed, 39 deletions(-) diff --git a/plugins/builder-herokuish/pre-build-buildpack b/plugins/builder-herokuish/pre-build-buildpack index f98c94b5b..a1e735432 100755 --- a/plugins/builder-herokuish/pre-build-buildpack +++ b/plugins/builder-herokuish/pre-build-buildpack @@ -13,7 +13,6 @@ trigger-builder-herokuish-pre-build-buildpack() { local DOCKER_COMMIT_LABEL_ARGS=("--change" "LABEL org.label-schema.schema-version=1.0" "--change" "LABEL org.label-schema.vendor=dokku" "--change" "LABEL com.dokku.app-name=$APP") local DOCKER_RUN_LABEL_ARGS="--label=com.dokku.app-name=$APP" - verify_app_name "$APP" IMAGE=$(get_app_image_name "$APP") [[ -z $(config_get --global CURL_CONNECT_TIMEOUT) ]] && config_set --global CURL_CONNECT_TIMEOUT=90 diff --git a/plugins/certs/functions b/plugins/certs/functions index 5c89238eb..2ace1f924 100755 --- a/plugins/certs/functions +++ b/plugins/certs/functions @@ -6,7 +6,6 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions" is_ssl_enabled() { declare desc="returns 0 if ssl is enabled for given app" local APP=$1 - verify_app_name "$APP" local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls" if [[ -e "$APP_SSL_PATH/server.crt" ]] && [[ -e "$APP_SSL_PATH/server.key" ]]; then @@ -19,7 +18,6 @@ is_ssl_enabled() { get_ssl_hostnames() { declare desc="returns a string of ssl hostnames extracted from an app's ssl certificate" local APP=$1 - verify_app_name "$APP" local SSL_PATH="$DOKKU_ROOT/$APP/tls" local SSL_HOSTNAME=$(openssl x509 -in "$SSL_PATH/server.crt" -noout -subject | tr '/' '\n' | grep CN= | cut -c4-) diff --git a/plugins/checks/functions b/plugins/checks/functions index df7b3f6c6..05f94327b 100755 --- a/plugins/checks/functions +++ b/plugins/checks/functions @@ -7,7 +7,6 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions" is_app_proctype_checks_disabled() { declare desc="return true if app's proctype(s) checks are disabled" local APP="$1" - verify_app_name "$APP" local PROCTYPE="$2" status=false local DOKKU_CHECKS_DISABLED=$(config_get "$APP" DOKKU_CHECKS_DISABLED || true) @@ -21,7 +20,6 @@ is_app_proctype_checks_disabled() { is_app_proctype_checks_skipped() { declare desc="return true if app's proctype(s) checks are skipped" local APP="$1" - verify_app_name "$APP" local PROCTYPE="$2" status=false local DOKKU_CHECKS_SKIPPED=$(config_get "$APP" DOKKU_CHECKS_SKIPPED || true) diff --git a/plugins/common/functions b/plugins/common/functions index dc721a5de..43fed2281 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -303,7 +303,6 @@ get_app_scheduler() { get_running_image_tag() { declare desc="retrieve current image tag for a given app. returns empty string if no deployed containers are found" local APP="$1" - verify_app_name "$APP" local CIDS=($(get_app_container_ids "$APP")) local RUNNING_IMAGE_TAG=$("$DOCKER_BIN" container inspect --format '{{ .Config.Image }}' "${CIDS[0]}" 2>/dev/null | awk -F: '{ print $2 }' || echo '') @@ -435,7 +434,6 @@ copy_from_image() { declare desc="copy file from named image to destination" declare IMAGE="$1" SRC_FILE="$2" DST_FILE="$3" local WORK_DIR="" - verify_app_name "$APP" local DOCKER_CREATE_LABEL_ARGS="--label=com.dokku.app-name=$APP" @@ -483,7 +481,6 @@ get_app_container_ids() { declare desc="returns list of docker container ids for given app and optional container_type" local APP="$1" local CONTAINER_TYPE="$2" - verify_app_name "$APP" [[ -f $DOKKU_ROOT/$APP/CONTAINER ]] && DOKKU_CIDS+=$(<"$DOKKU_ROOT/$APP/CONTAINER") if [[ -n "$CONTAINER_TYPE" ]]; then @@ -581,7 +578,6 @@ is_app_running() { local APP="$1" dokku_log_warn "Deprecated: ps#fn-ps-is-app-running" - verify_app_name "$APP" local APP_RUNNING_CONTAINER_IDS=$(get_app_running_container_ids "$APP" 2>/dev/null) @@ -596,7 +592,6 @@ dokku_build() { declare desc="build phase" declare APP="$1" IMAGE_SOURCE_TYPE="$2" SOURCECODE_WORK_DIR="$3" - verify_app_name "$APP" plugn trigger builder-build "$IMAGE_SOURCE_TYPE" "$APP" "$SOURCECODE_WORK_DIR" } @@ -630,8 +625,6 @@ release_and_deploy() { local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG") local DOKKU_DOCKERFILE_PORTS - verify_app_name "$APP" - if verify_image "$IMAGE"; then if is_image_herokuish_based "$IMAGE" "$APP"; then local IMAGE_SOURCE_TYPE="herokuish" @@ -855,7 +848,6 @@ get_app_raw_tcp_ports() { source "$PLUGIN_AVAILABLE_PATH/config/functions" local APP="$1" - verify_app_name "$APP" local DOCKERFILE_PORTS="$(config_get "$APP" DOKKU_DOCKERFILE_PORTS)" for p in $DOCKERFILE_PORTS; do if [[ ! "$p" =~ .*udp.* ]]; then @@ -870,7 +862,6 @@ get_app_raw_tcp_ports() { get_container_ports() { declare desc="returns published ports from app containers" local APP="$1" - verify_app_name "$APP" local APP_CIDS="$(get_app_container_ids "$APP")" local cid @@ -886,7 +877,6 @@ get_app_urls() { declare URL_TYPE="$1" APP="$2" local urls - verify_app_name "$APP" urls=$(plugn trigger app-urls "$APP" "$URL_TYPE") if [[ -n "$urls" ]]; then echo "$urls" | sort @@ -1045,7 +1035,6 @@ merge_dedupe_list() { acquire_app_deploy_lock() { declare desc="acquire advisory lock for use in git/tar deploys" local APP="$1" - verify_app_name "$APP" local LOCK_TYPE="${2:-waiting}" local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock" local LOCK_WAITING_MSG="$APP currently has a deploy lock in place. Waiting..." @@ -1057,7 +1046,6 @@ acquire_app_deploy_lock() { release_app_deploy_lock() { declare desc="release advisory lock used in git/tar deploys" local APP="$1" - verify_app_name "$APP" local APP_DEPLOY_LOCK_FILE="$DOKKU_ROOT/$APP/.deploy.lock" release_advisory_lock "$APP_DEPLOY_LOCK_FILE" diff --git a/plugins/config/docker-args-deploy b/plugins/config/docker-args-deploy index b4a0c0d6e..1f1e53579 100755 --- a/plugins/config/docker-args-deploy +++ b/plugins/config/docker-args-deploy @@ -13,7 +13,6 @@ trigger-config-docker-args() { IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") STDIN=$(cat) trigger="$0 config_docker_args" - verify_app_name "$APP" if ! is_image_herokuish_based "$IMAGE" "$APP"; then ENV_ARGS="$(config_export app "$APP" --format docker-args --merged)" diff --git a/plugins/domains/functions b/plugins/domains/functions index 5baed3aec..64bfcdea7 100755 --- a/plugins/domains/functions +++ b/plugins/domains/functions @@ -7,7 +7,6 @@ set -eo pipefail disable_app_vhost() { declare desc="disable vhost support for given application" declare APP=$1 RESTART_APP="$2" - verify_app_name "$APP" local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" local APP_URLS_PATH="$DOKKU_ROOT/$APP/URLS" @@ -24,7 +23,6 @@ disable_app_vhost() { domains_setup() { declare desc="setup domains to default state" - verify_app_name "$1" local APP="$1" local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" local GLOBAL_VHOST_PATH="$DOKKU_ROOT/VHOST" @@ -45,7 +43,6 @@ domains_setup() { domains_add() { declare desc="add list of domains to app" - verify_app_name "$1" local APP="$1" local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" @@ -74,7 +71,6 @@ domains_add() { domains_remove() { declare desc="remove list of app domains" - verify_app_name "$1" local APP="$1" local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" shift 1 @@ -89,7 +85,6 @@ domains_remove() { domains_set() { declare desc="set list of domains for app" - verify_app_name "$1" local APP="$1" local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" @@ -113,7 +108,6 @@ domains_set() { domains_disable() { declare desc="disable domains/VHOST support" - verify_app_name "$1" local APP="$1" local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" @@ -127,7 +121,6 @@ domains_disable() { domains_enable() { declare desc="enable domains/VHOST support" - verify_app_name "$1" local APP="$1" RESTART_APP="$2" local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" local DEFAULT_VHOSTS="$(get_default_vhosts "$APP")" @@ -202,7 +195,6 @@ domains_set_global() { enable_app_vhost() { declare desc="enable vhost support for given application" declare APP=$1 RESTART_APP="$2" - verify_app_name "$APP" plugn trigger pre-enable-vhost "$APP" [[ "$RESTART_APP" == "--no-restart" ]] && local CONFIG_SET_ARGS=$RESTART_APP @@ -212,7 +204,6 @@ enable_app_vhost() { get_app_domains() { declare desc="return app domains" - verify_app_name "$1" local APP=$1 local APP_VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" local GLOBAL_HOSTNAME_PATH="$DOKKU_ROOT/HOSTNAME" @@ -228,7 +219,6 @@ get_app_domains() { get_default_vhosts() { declare desc="return default vhosts" - verify_app_name "$1" local APP="$1" local RE_IPV4="$(get_ipv4_regex)" local RE_IPV6="$(get_ipv6_regex)" @@ -264,7 +254,6 @@ is_app_vhost_enabled() { declare desc="returns true or false if vhost support is enabled for a given application" local APP=$1 - verify_app_name "$APP" local NO_VHOST=$(config_get "$APP" NO_VHOST) local APP_VHOST_ENABLED=true diff --git a/plugins/git/functions b/plugins/git/functions index 980808e4e..67222785e 100755 --- a/plugins/git/functions +++ b/plugins/git/functions @@ -239,7 +239,6 @@ fn-git-create-hook() { declare APP="$1" local APP_PATH="$DOKKU_ROOT/$APP" local PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive" - verify_app_name "$APP" if [[ ! -d "$APP_PATH/refs" ]]; then git init --bare "$APP_PATH" >/dev/null diff --git a/plugins/nginx-vhosts/functions b/plugins/nginx-vhosts/functions index 6af95592d..0fc279088 100755 --- a/plugins/nginx-vhosts/functions +++ b/plugins/nginx-vhosts/functions @@ -126,7 +126,6 @@ restart_nginx() { nginx_logs() { declare desc="display app nginx logs" declare NGINX_LOGS_TYPE="${1#nginx:}" APP="$2" - verify_app_name "$APP" local NGINX_LOGS_TYPE=${NGINX_LOGS_TYPE%-logs} local NGINX_LOGS_PATH="$("fn-nginx-${NGINX_LOGS_TYPE}-log-path" "$APP")" @@ -147,7 +146,6 @@ nginx_logs() { configure_nginx_ports() { declare desc="configure nginx listening ports" local APP=$1 - verify_app_name "$APP" local RAW_TCP_PORTS="$(get_app_raw_tcp_ports "$APP")" local DOKKU_PROXY_PORT=$(config_get "$APP" DOKKU_PROXY_PORT) local DOKKU_PROXY_SSL_PORT=$(config_get "$APP" DOKKU_PROXY_SSL_PORT) @@ -204,7 +202,6 @@ configure_nginx_ports() { validate_ssl_domains() { declare desc="check configured domains against SSL cert contents and show warning if mismatched" local APP=$1 - verify_app_name "$APP" local VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" local SSL_HOSTNAME=$(get_ssl_hostnames "$APP") local SSL_HOSTNAME_REGEX=$(echo "$SSL_HOSTNAME" | xargs | sed 's|\.|\\.|g' | sed 's/\*/\[^\.\]\*/g' | sed 's/ /|/g') @@ -227,7 +224,6 @@ validate_ssl_domains() { get_custom_nginx_template() { declare desc="attempts to copy custom nginx template from app image" local APP="$1" - verify_app_name "$APP" local DESTINATION_FILE="$2" local IMAGE_TAG="$(get_running_image_tag "$APP")" local IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") @@ -350,7 +346,6 @@ is_grpc_enabled() { nginx_build_config() { declare desc="build nginx config to proxy app containers using sigil" declare APP="$1" DOKKU_APP_LISTEN_PORT="$2" DOKKU_APP_LISTEN_IP="$3" - verify_app_name "$APP" local VHOST_PATH="$DOKKU_ROOT/$APP/VHOST" local APP_URLS_PATH="$DOKKU_ROOT/$APP/URLS" local NGINX_TEMPLATE_NAME="nginx.conf.sigil" diff --git a/plugins/nginx-vhosts/proxy-disable b/plugins/nginx-vhosts/proxy-disable index 7144841ac..4476ba86e 100755 --- a/plugins/nginx-vhosts/proxy-disable +++ b/plugins/nginx-vhosts/proxy-disable @@ -8,7 +8,6 @@ trigger-nginx-vhosts-proxy-disable() { declare trigger="proxy-disable" declare APP="$1" - verify_app_name "$APP" if [[ "$(plugn trigger proxy-type "$APP")" == "nginx" ]]; then plugn trigger domains-disable "$APP" false plugn trigger app-restart "$APP" diff --git a/plugins/nginx-vhosts/proxy-enable b/plugins/nginx-vhosts/proxy-enable index 9702114cf..0402f66de 100755 --- a/plugins/nginx-vhosts/proxy-enable +++ b/plugins/nginx-vhosts/proxy-enable @@ -8,7 +8,6 @@ trigger-nginx-vhosts-proxy-enable() { declare trigger="proxy-enable" declare APP="$1" - verify_app_name "$APP" if [[ "$(plugn trigger proxy-type "$APP")" == "nginx" ]]; then plugn trigger domains-enable "$APP" "false" plugn trigger app-restart "$APP" diff --git a/plugins/scheduler-docker-local/scheduler-deploy b/plugins/scheduler-docker-local/scheduler-deploy index 9613ae12d..f7dfc6d94 100755 --- a/plugins/scheduler-docker-local/scheduler-deploy +++ b/plugins/scheduler-docker-local/scheduler-deploy @@ -21,7 +21,6 @@ trigger-scheduler-docker-local-scheduler-deploy() { local DOKKU_DOCKER_STOP_TIMEOUT DOKKU_HEROKUISH DOKKU_NETWORK_BIND_ALL IMAGE DOKKU_HEROKUISH=false IMAGE=$(get_deploying_app_image_name "$APP" "$IMAGE_TAG") - verify_app_name "$APP" plugn trigger pre-deploy "$APP" "$IMAGE_TAG" is_image_herokuish_based "$IMAGE" "$APP" && DOKKU_HEROKUISH=true diff --git a/plugins/tar/functions b/plugins/tar/functions index 781dba69f..9a8302c99 100755 --- a/plugins/tar/functions +++ b/plugins/tar/functions @@ -7,7 +7,6 @@ source "$PLUGIN_AVAILABLE_PATH/config/functions" tar_build() { declare desc="builds apps from tarball via command line" local APP="$1" - verify_app_name "$APP" shift 1 # clean up after ourselves