From 59912d43f1790137ab5b992d13e4581314b6bdc2 Mon Sep 17 00:00:00 2001 From: Justin Clark Date: Fri, 13 Nov 2015 17:53:56 -0800 Subject: [PATCH 1/2] fix Must specify DOMAIN error over ssh --- dokku | 2 ++ plugins/domains/commands | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dokku b/dokku index d1b889f9636..1782e873ea0 100755 --- a/dokku +++ b/dokku @@ -60,7 +60,9 @@ if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then xargs $0 <<<$SSH_ORIGINAL_COMMAND exit $? else + set -f $0 $SSH_ORIGINAL_COMMAND + set +f exit $? fi fi diff --git a/plugins/domains/commands b/plugins/domains/commands index 0208368a90c..47fabe92480 100755 --- a/plugins/domains/commands +++ b/plugins/domains/commands @@ -65,7 +65,7 @@ case "$1" in exit 1 fi - if [[ $(egrep ^"$3"$ "$DOKKU_ROOT/$APP/VHOST" > /dev/null 2>&1; echo $?) -eq 0 ]]; then + if [[ $(grep --fixed-strings "$3" "$DOKKU_ROOT/$APP/VHOST" > /dev/null 2>&1; echo $?) -eq 0 ]]; then echo "$3 is already defined for $APP" exit 1 fi From 4b2a777425d51d43113f1b365242ee3b1431a166 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Thu, 19 Nov 2015 12:03:31 -0500 Subject: [PATCH 2/2] add test for wildcard domain. don't match domain substring. closes #1614 --- plugins/domains/commands | 2 +- tests/unit/domains.bats | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/domains/commands b/plugins/domains/commands index 47fabe92480..493493ae274 100755 --- a/plugins/domains/commands +++ b/plugins/domains/commands @@ -65,7 +65,7 @@ case "$1" in exit 1 fi - if [[ $(grep --fixed-strings "$3" "$DOKKU_ROOT/$APP/VHOST" > /dev/null 2>&1; echo $?) -eq 0 ]]; then + if [[ $(egrep -w "^{$3}$" "$DOKKU_ROOT/$APP/VHOST" > /dev/null 2>&1; echo $?) -eq 0 ]]; then echo "$3 is already defined for $APP" exit 1 fi diff --git a/tests/unit/domains.bats b/tests/unit/domains.bats index de07060e3dd..7538f4028fa 100644 --- a/tests/unit/domains.bats +++ b/tests/unit/domains.bats @@ -46,6 +46,17 @@ teardown() { refute_line "test.app.dokku.me" } +@test "(domains) domains:remove (wildcard domain)" { + run dokku domains:add $TEST_APP *.dokku.me + echo "output: "$output + echo "status: "$status + assert_success + run dokku domains:remove $TEST_APP *.dokku.me + echo "output: "$output + echo "status: "$status + refute_line "*.dokku.me" +} + @test "(domains) domains:clear" { run dokku domains:add $TEST_APP test.app.dokku.me echo "output: "$output