示例#1
0
def _final_read_only_check_parameters(entries: LegacyCheckParameters) -> Parameters:
    raw_parameters = (time_resolved_check_parameters(entries) if isinstance(
        entries, cmk.base.config.TimespecificParamList) else entries)
    # TODO (mo): this needs cleaning up, once we've gotten rid of tuple parameters.
    # wrap_parameters is a no-op for dictionaries.
    # For auto-migrated plugins expecting tuples, they will be
    # unwrapped by a decorator of the original check_function.
    return Parameters(wrap_parameters(raw_parameters))
示例#2
0
def determine_check_params(entries: LegacyCheckParameters) -> Parameters:
    # TODO (mo): obviously, we do not want to keep legacy_determine_check_params
    # around in the long run. This needs cleaning up, once we've gotten
    # rid of tuple parameters.
    params = legacy_determine_check_params(entries)
    # wrap_parameters is a no-op for dictionaries.
    # For auto-migrated plugins expecting tuples, they will be
    # unwrapped by a decorator of the original check_function.
    return Parameters(wrap_parameters(params))
示例#3
0
def _final_read_only_check_parameters(
    entries: Union[TimespecificParameters,
                   LegacyCheckParameters]) -> Parameters:
    raw_parameters = (entries.evaluate(cmk.base.core.timeperiod_active) if
                      isinstance(entries, TimespecificParameters) else entries)

    # TODO (mo): this needs cleaning up, once we've gotten rid of tuple parameters.
    # wrap_parameters is a no-op for dictionaries.
    # For auto-migrated plugins expecting tuples, they will be
    # unwrapped by a decorator of the original check_function.
    return Parameters(wrap_parameters(raw_parameters))
def test_un_wrap_parameters(params):
    wrapped = check_plugins_legacy.wrap_parameters(params)
    assert isinstance(wrapped, dict)
    assert check_plugins_legacy.unwrap_parameters(wrapped) is params