Project

General

Profile

Bug #38560

Updated by Volker Theile about 5 years ago

The previously intended workflow of ``get_localized_module_option()`` that would lookup for localized config options with a fallback to global config options is broken now if there is a ``default`` defined in ``MODULE_OPTIONS``. The problem is that a user must explicitly configure the localized key if he wants to override something, it's not possible anymore to use the global key to do that IF there is a ``default`` set in ``MODULE_OPTIONS``.

Let's assume the following scenario:

- 'ssl' in dashboard MODULE_OPTIONS defaults to 'True'
- User configures 'mgr/dashboard/ssl' to 'False'

The module implementation queries the localized config option via
``get_localized_module_option()``. In this case the following happens:

1) get_localized_module_option(key='ssl', default='True')
2) _get_localized(key='ssl', default='True', setter=_get_module_option)
3) _get_module_option(key='<MGR_ID>/ssl', default=None)
4) _ceph_get_module_option('dashboard', '<MGR_ID>/ssl') returns None
5) MODULE_OPTION_DEFAULTS.get('ssl', None) returns True

Finally the caller of the function will get 'True', but this is not the expected result IMHO. I expected to get ``False`` from ``mgr/dashboard/ssl``.

If ``ssl`` wouldn't be configured in ``MODULE_OPTIONS``, then the following code
path will be executed and returns the expected value.

5) MODULE_OPTION_DEFAULTS.get('ssl', None) returns None
6) _get_module_option(key='ssl', 'True') returns False

The issue was introduced by: Link to source code:
https://github.com/ceph/ceph/commit/0f814f38e5d811d84fe07fe2d443c1038d53ca9a
https://github.com/ceph/ceph/commit/0f814f38e5d811d84fe07fe2d443c1038d53ca9a#r32541122

Back