-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix: missing etcd init_dir and unable to list resource #10569
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, I think you are right. To improve this, I think we can add a judgment, such as or value="init_dir"
Description
Fixes #9618
Checklist