Skip to content

Commit

Permalink
[bugfix(CLI)]: check whether the user has enabled etcd v2 protocol. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dabue authored Jun 9, 2020
1 parent b59a519 commit d780f74
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis/apisix_cli_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ fi

set -ex

echo "rollback to the default admin config"
echo "passed: rollback to the default admin config"
11 changes: 11 additions & 0 deletions bin/apisix
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,17 @@ local function init_etcd(show_output)

local host_count = #(yaml_conf.etcd.host)

-- check whether the user has enabled etcd v2 protocol
for index, host in ipairs(yaml_conf.etcd.host) do
uri = host .. "/v2/keys"
local cmd = "curl -i -m ".. timeout * 2 .. " -o /dev/null -s -w %{http_code} " .. uri
local res = excute_cmd(cmd)
if res == "404" then
io.stderr:write(string.format("failed: please make sure that you have enabled the v2 protocol of etcd on %s.\n", host))
return
end
end

local etcd_ok = false
for index, host in ipairs(yaml_conf.etcd.host) do

Expand Down

0 comments on commit d780f74

Please sign in to comment.