ensure app name begins with lowercase. closes #1774
This commit is contained in:
@@ -4,6 +4,7 @@ source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|||||||
|
|
||||||
apps_create() {
|
apps_create() {
|
||||||
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
[[ -z $1 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||||
|
[[ ! "$1" =~ ^[a-z].* && ! "$1" =~ ^[0-9].* ]] && dokku_log_fail "App name must begin with lowercase alphanumeric character"
|
||||||
[[ -d "$DOKKU_ROOT/$1" ]] && dokku_log_fail "Name is already taken"
|
[[ -d "$DOKKU_ROOT/$1" ]] && dokku_log_fail "Name is already taken"
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,10 @@ dokku_container_log_verbose_quiet() {
|
|||||||
verify_app_name() {
|
verify_app_name() {
|
||||||
local APP="$1"
|
local APP="$1"
|
||||||
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
|
[[ ! -n "$APP" ]] && dokku_log_fail "(verify_app_name) APP must not be null"
|
||||||
|
if [[ ! "$APP" =~ ^[a-z].* && ! "$APP" =~ ^[0-9].* ]]; then
|
||||||
|
[[ -d "$DOKKU_ROOT/$APP" ]] && rm -rf "$DOKKU_ROOT/$APP"
|
||||||
|
dokku_log_fail "App name must begin with lowercase alphanumeric character"
|
||||||
|
fi
|
||||||
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"
|
[[ ! -d "$DOKKU_ROOT/$APP" ]] && dokku_log_fail "App $APP does not exist"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -17,6 +17,17 @@ load test_helper
|
|||||||
echo "status: "$status
|
echo "status: "$status
|
||||||
assert_success
|
assert_success
|
||||||
destroy_app
|
destroy_app
|
||||||
|
|
||||||
|
run dokku apps:create 1994testapp
|
||||||
|
echo "output: "$output
|
||||||
|
echo "status: "$status
|
||||||
|
assert_success
|
||||||
|
dokku --force apps:destroy 1994testapp
|
||||||
|
|
||||||
|
run dokku apps:create TestApp
|
||||||
|
echo "output: "$output
|
||||||
|
echo "status: "$status
|
||||||
|
assert_failure
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "(apps) apps:destroy" {
|
@test "(apps) apps:destroy" {
|
||||||
|
|||||||
Reference in New Issue
Block a user