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
mgr/dashboard: fix query parameters in task annotated endpoints #23229
Conversation
Fixes: http://tracker.ceph.com/issues/25096 Signed-off-by: Ricardo Dias <rdias@suse.com>
if idx < len(args): | ||
arg_map[arg] = args[idx] | ||
arg_map[param['name']] = args[idx] |
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.
Too many ]s and [s. Can we create a new named tuple FuncParam
in _get_function_params
?
from collections import namedtuple
FuncParam = namedtuple('FuncParam', 'name default required')
func_params.append(FuncParam(name=param , default=val, required=False)
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.
I could but that would require a lot of changes which are out of scope of this fix. I suggest you to create an issue for that.
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.
It wouldn't require any algorithmic changes, except for replacing param['xyz']
with param.xyz
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.
The _get_function_params
function is used in more 6 places throughout the code.
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.
Exactly. That's why we need to return proper types here.
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.
The code in this PR is fixing a concrete bug reported in the issue tracker. I don't see a strong reason to also add an additional commit with code cleanup to this PR. The code cleanup can be done in a separate PR.
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.
Right now, this issue is just an inconvenience to @tspmelo . Merging this as it is would introduce further technical dept.
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.
(Btw, I'm not blocking this PR in github)
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.
Endpoint where I found this problem is working now.
The fix itself works as expected. |
Fixes: http://tracker.ceph.com/issues/25096
I've also added a unit test to capture the issue reported above.
Signed-off-by: Ricardo Dias rdias@suse.com