Branch: refs/heads/master
Home:
https://github.com/tribe29/checkmk
Commit: 6aae0e2a012dbe2ec6fe3cc91cd8e9e5a9eb21cd
https://github.com/tribe29/checkmk/commit/6aae0e2a012dbe2ec6fe3cc91cd8e9e5a…
Author: Mathias Laurin <mathias.laurin(a)tribe29.com>
Date: 2021-06-17 (Thu, 17 Jun 2021)
Changed paths:
M cmk/base/core_config.py
M cmk/core_helpers/controller.py
M cmk/core_helpers/paths.py
M tests/unit/cmk/base/test_core_config.py
M tests/unit/cmk/core_helpers/test_config_paths.py
M tests/unit/cmk/core_helpers/test_controller.py
Log Message:
-----------
Make classes for the serial
This clarifies the typing and the fact that the "serial" is but an
implementation detail of the paths.
Before, we had serials with values such as '0', '1', '2', ...
that
should obviously have been integers from the beginning. Also note
that the value is increased when the configuration changes and the
actual representation of the serial (the numbers here) is never
relevant to user code.
Moreover, `OptionalConfigSerial`, `ConfigSerial`, and `LATEST_SERIAL`
are actually `str` so that the code was not really typed.
And finally, the very fact that `OptionalConfigSerial` is not
`Optional[ConfigSerial]` is simply uncivil.
We replace the `str` types with three classes: A `VersionedConfigPath`
with an integer (an actual integer, mind you) serial, a `LatestConfigPath`
representing a constant path to the version, and `ConfigPath` that may
be either one.
In this step, we only remove the next_... and current_... methods that
were used only once and add a compatibility layer.
Change-Id: I23b666c1feb347c7839cb1f9f1add37dc4342ca2