Branch: refs/heads/master
Home:
https://github.com/tribe29/checkmk
Commit: 3a629b2e682c09afd8226355d4ecc3cdaae0f274
https://github.com/tribe29/checkmk/commit/3a629b2e682c09afd8226355d4ecc3cda…
Author: Joerg Herbel <joerg.herbel(a)tribe29.com>
Date: 2020-10-12 (Mon, 12 Oct 2020)
Changed paths:
M cmk/gui/valuespec.py
M tests/unit/cmk/gui/test_valuespec.py
Log Message:
-----------
DropdownChoice: add field to specify deprecated choices
DropdownChoice handles invalid values using the field invalid_choice_title,
which results in an additional option with the specified title in case of
an invalid value. As long as this additional option is selected, the rule
cannot be saved.
Previously, this only worked in case the current (invalid) value had the
same type as one of the valid options. If this was not the case, the
rule fell back to default values for all fields. This change adds the
additional argument deprecated_choices to DropdownChoice. Here, you can
specify a list of deprecated choices. The datatype of a given value will
now be considered valid (and avoid the fallback to defaults) if
* its TYPE matches one of the valid types or
* its VALUE matches one the deprecated values.
This is especially needed for the rule 'Process discovery', where werk
6646 added the DropdownChoice field 'CPU rescale maximum load'. The
valid options are True and False (type bool). In order to point the user
at the need to edit his or her rules, an explicitly invalid value is
added via a transform along with an appriopriate invalid_choice_title.
However, since this invalid value is not (and can never be) of type bool,
such legacy rules can effectively not be edited any more in the GUI.
CMK-5810
Change-Id: Ib1414a217c3442ebdeb8fb90b6ede823c44402ca