Actions
Bug #38639
openmgr: localized keys are not auto-converted according the MODULE_OPTIONS settings
% Done:
0%
Source:
Development
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Description
If a localized key like 'mgr/dashboard/x/server_port' is requested by MgrModule::get_localized_module_option('server_port', 8443) the value is not converted to integer as defined in
MODULE_OPTIONS = [ Option(name='server_addr', type='str', default='::'), Option(name='server_port', type='int', default=8443), Option(name='jwt_token_ttl', type='int', default=28800), Option(name='password', type='str', default=''), Option(name='url_prefix', type='str', default=''), Option(name='username', type='str', default=''), Option(name='key_file', type='str', default=''), Option(name='crt_file', type='str', default=''), Option(name='ssl', type='bool', default=True) ]
instead it is returned as string. This is because the auto-convertion only applies to keys like server_addr, server_port, ..., others (localized) like 'x/server_port', '<MGR_ID>/server_addr' are ignored and not processed.
IMHO this could be fixed by simply trimming the option name 'x/foo' => ''foo' in PyModule::get_typed_option_value (https://github.com/ceph/ceph/blob/master/src/mgr/PyModule.cc#L622).
See https://github.com/ceph/ceph/pull/26738#discussion_r263713336 for another example.
Actions