Skip to content

Commit

Permalink
fix wrong condition
Browse files Browse the repository at this point in the history
  • Loading branch information
An-DJ committed Mar 23, 2023
1 parent 29c2e80 commit 967ad48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apisix/cli/ops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ local function init(env)
local allow_admin = yaml_conf.deployment.admin and
yaml_conf.deployment.admin.allow_admin
if yaml_conf.apisix.enable_admin and allow_admin
and table.getn(allow_admin) == 1 and allow_admin[1] == "127.0.0.0/24" then
and #allow_admin == 1 and allow_admin[1] == "127.0.0.0/24" then
checked_admin_key = true
end

Expand Down
4 changes: 1 addition & 3 deletions t/cli/test_admin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ echo "pass: missing admin key and show ERROR message"

# missing admin key, only allow 127.0.0.0/24 to access admin api

git checkout conf/config.yaml

echo '
deployment:
admin:
Expand All @@ -169,7 +167,7 @@ deployment:
make init > output.log 2>&1 | true

grep -E "ERROR: missing valid Admin API token." output.log > /dev/null
if [ ! $? -ne 0 ]; then
if [ $? -eq 0 ]; then
echo "failed: should not show 'ERROR: missing valid Admin API token.'"
exit 1
fi
Expand Down

0 comments on commit 967ad48

Please sign in to comment.