diff --git a/config/etcd.lua b/config/etcd.lua index e83f83a..a68bee4 100644 --- a/config/etcd.lua +++ b/config/etcd.lua @@ -181,7 +181,7 @@ end function M:list(keyspath) local res, response = self:request("GET","keys"..keyspath, { recursive = true, quorum = true }) -- print(yaml.encode(res)) - if res.node then + if res.node and res.node.key then local result = self:recursive_extract(keyspath,res.node) -- todo: make it with metatable -- print(yaml.encode(result)) @@ -189,6 +189,9 @@ function M:list(keyspath) -- for _,n in pairs(res.node) do -- print() -- end + elseif res.node and (not res.node.key) then + -- Don't use "/" as a etcd prefix in config + error(('Failed to list keys by "%s", node.key is nil'):format(keyspath)) else error(json.encode(res),2) end