Project

General

Profile

Bug #38560

mgr: get_localized_module_option function is broken

Added by Volker Theile 3 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
ceph-mgr
Target version:
Start date:
03/04/2019
Due date:
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:

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

Related to mgr - Bug #38528: mgr/dashboard: Unable to disable SSL support Resolved 03/01/2019

History

#1 Updated by Volker Theile 3 months ago

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

#2 Updated by Volker Theile 3 months ago

  • Description updated (diff)

#3 Updated by Volker Theile 3 months ago

  • Description updated (diff)

#4 Updated by Volker Theile 3 months ago

  • Description updated (diff)

#5 Updated by Volker Theile 3 months ago

  • Status changed from New to Need Review

#6 Updated by Sage Weil 3 months ago

  • Status changed from Need Review to Resolved

#7 Updated by Volker Theile 3 months ago

  • Pull request ID set to 26736

Also available in: Atom PDF