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

valid check #27

Merged
merged 1 commit into from
Sep 14, 2017
Merged
Changes from all commits
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
8 changes: 4 additions & 4 deletions lib/resty/checkups/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,13 @@ local function gen_upstream(skey, upstream)
-- check servers
local ok
for level, cls in pairs(ups.cluster) do
if not cls or not next(cls) then
if type(cls) ~= "table" or not next(cls) then
return nil, "can not update empty level"
end

local servers = cls.servers
if not servers or not next(servers) then
return nil, "can not update empty servers"
if type(servers) ~= "table" or not next(servers) then
return nil, "servers invalid"
end

for _, srv in ipairs(servers) do
Expand Down Expand Up @@ -284,7 +284,7 @@ end


function _M.update_upstream(skey, upstream)
if not upstream or not next(upstream) then
if type(upstream) ~= "table" or not next(upstream) then
return false, "can not set empty upstream"
end

Expand Down