fix: missing etcd init_dir and unable to list resource#10569
Conversation
bzp2010
left a comment
There was a problem hiding this comment.
This is only a temporary solution to get the API working again with a patch, but does not address its underlying issues.
We can fix the problem completely in a future PR.
| nodes = setmetatable({}, array_mt) | ||
| } | ||
| local kvs = res.body.kvs | ||
| if #kvs >= 1 and not kvs[1].value then |
There was a problem hiding this comment.
not kvs[1].value
With all due respect, this is a completely false assumption. Why is the value null?
The lua-resty-etcd uses cjson.safe to parse JSON, so init_dir values that are not in JSON format will be parsed as nil.
Therefore, I think this is only a temporary solution that cannot solve the problem completely.
There was a problem hiding this comment.
This is the previous logic, I did not modify it.
The previous non empty processing method was incorrect, I just improved it.
There was a problem hiding this comment.
However, I think you are right. To improve this, I think we can add a judgment, such as or value="init_dir"
## Description Backport apache#10569 Follow up changes: https://github.com/apache/apisix/pull/11601/files#diff-e180fd4745b8f8c30fa91a6298e91a0b4dde186a1527b892539d6f9bc9c41c3eR222 ## Checklist - [ ] I have explained **WHY** we need this PR and **HOW** the problem it solves - [ ] The title of the PR concisely describes the code modification and complies with APISIX specifications. - [ ] I have explained the changes or the new features added to this PR - [ ] I have added **e2e test cases** corresponding to this change - [ ] I have updated the documentation to reflect this change **NOTE: This PR will not be reviewed and merged until the contents of these checklists are completed.** --------- Co-authored-by: AlinsRan <[email protected]>
Description
Fixes #9618
Checklist