Project

General

Profile

Actions

Bug #38560

closed

mgr: get_localized_module_option function is broken

Added by Volker Theile about 5 years ago. Updated about 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
ceph-mgr
Target version:
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

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:
https://github.com/ceph/ceph/commit/0f814f38e5d811d84fe07fe2d443c1038d53ca9a
https://github.com/ceph/ceph/commit/0f814f38e5d811d84fe07fe2d443c1038d53ca9a#r32541122


Related issues 1 (0 open1 closed)

Related to Dashboard - Bug #38528: mgr/dashboard: Unable to disable SSL supportResolvedVolker Theile

Actions
Actions #1

Updated by Volker Theile about 5 years ago

  • Related to Bug #38528: mgr/dashboard: Unable to disable SSL support added
Actions #2

Updated by Volker Theile about 5 years ago

  • Description updated (diff)
Actions #3

Updated by Volker Theile about 5 years ago

  • Description updated (diff)
Actions #4

Updated by Volker Theile about 5 years ago

  • Description updated (diff)
Actions #5

Updated by Volker Theile about 5 years ago

  • Status changed from New to Fix Under Review
Actions #6

Updated by Sage Weil about 5 years ago

  • Status changed from Fix Under Review to Resolved
Actions #7

Updated by Volker Theile about 5 years ago

  • Pull request ID set to 26736
Actions

Also available in: Atom PDF