Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix(CLI)]: check whether the user has enabled etcd v2 protocol. #1665

Merged
merged 5 commits into from
Jun 9, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update the etcd v2 check.
dabue committed Jun 8, 2020
commit 6fa3655c888b157f7d304eba09bd452cd510d235
10 changes: 0 additions & 10 deletions .travis/apisix_cli_test.sh
Original file line number Diff line number Diff line change
@@ -23,16 +23,6 @@

set -ex

# check if the user has enabled etcd v2 protocol.

code=$(curl -i -m 10 -o /dev/null -s -w %{http_code} 'http://127.0.0.1:2379/v2/keys')
if [ $code -eq 404 ]; then
echo "failed: Please make sure that you have enabled the v2 protocol of etcd."
exit 1
fi

echo "passed: the user has enabled etcd v2 protocol."

# check whether the 'reuseport' is in nginx.conf .
make init

11 changes: 11 additions & 0 deletions bin/apisix
Original file line number Diff line number Diff line change
@@ -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
print("failed: Please make sure that you have enabled the v2 protocol of etcd on " .. host)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use std_err to print the error message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have updated it.

return
end
end

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