diff --git a/cmk/base/automations/check_mk.py b/cmk/base/automations/check_mk.py index f3fd3642bfc..c006583e034 100644 --- a/cmk/base/automations/check_mk.py +++ b/cmk/base/automations/check_mk.py @@ -325,8 +325,8 @@ def section_error_handling( parser=parser, fetcher=fetcher, summarizer=CMKSummarizer( - config_cache, hostname, + config_cache.summary_config, override_non_ok_state=None, ), section_plugins=SectionPluginMapper(), @@ -592,8 +592,8 @@ def _execute_discovery( parser=parser, fetcher=fetcher, summarizer=CMKSummarizer( - config_cache, host_name, + config_cache.summary_config, override_non_ok_state=None, ), section_plugins=SectionPluginMapper(), @@ -767,7 +767,9 @@ def section_error_handling( parser=parser, fetcher=fetcher, summarizer=CMKSummarizer( - config_cache, host_name, override_non_ok_state=None + host_name, + config_cache.summary_config, + override_non_ok_state=None, ), section_plugins=section_plugins, section_error_handling=section_error_handling, diff --git a/cmk/base/checkers.py b/cmk/base/checkers.py index 3e81c9e5bd0..cb86055f910 100644 --- a/cmk/base/checkers.py +++ b/cmk/base/checkers.py @@ -213,13 +213,13 @@ def __call__( class CMKSummarizer: def __init__( self, - config_cache: ConfigCache, host_name: HostName, + summary_config: Callable[[HostName, str], SummaryConfig], *, override_non_ok_state: ServiceState | None = None, ) -> None: - self.config_cache: Final = config_cache self.host_name: Final = host_name + self.summary_config: Final = summary_config self.override_non_ok_state: Final = override_non_ok_state def __call__( @@ -230,7 +230,7 @@ def __call__( _summarize_host_sections( host_sections, source, - self.config_cache.summary_config(source.hostname, source.ident), + self.summary_config(source.hostname, source.ident), override_non_ok_state=self.override_non_ok_state, ) for source, host_sections in host_sections diff --git a/cmk/base/modes/check_mk.py b/cmk/base/modes/check_mk.py index 37eee908c20..58fd1514b4a 100644 --- a/cmk/base/modes/check_mk.py +++ b/cmk/base/modes/check_mk.py @@ -1823,8 +1823,8 @@ def mode_check_discovery( logger=logging.getLogger("cmk.base.discovery"), ) summarizer = CMKSummarizer( - config_cache, hostname, + config_cache.summary_config, override_non_ok_state=None, ) error_handler = CheckResultErrorHandler( @@ -2321,8 +2321,8 @@ def mode_check( logger=logging.getLogger("cmk.base.checking"), ) summarizer = CMKSummarizer( - config_cache, hostname, + config_cache.summary_config, override_non_ok_state=None, ) dry_run = options.get("no-submit", False) @@ -2572,8 +2572,8 @@ def section_error_handling( parameters = config_cache.hwsw_inventory_parameters(hostname) raw_intervals_from_config = config_cache.inv_retention_intervals(hostname) summarizer = CMKSummarizer( - config_cache, hostname, + config_cache.summary_config, override_non_ok_state=parameters.fail_status, ) @@ -2797,8 +2797,8 @@ def mode_inventory_as_check( logger=logging.getLogger("cmk.base.inventory"), ) summarizer = CMKSummarizer( - config_cache, hostname, + config_cache.summary_config, override_non_ok_state=parameters.fail_status, ) error_handler = CheckResultErrorHandler( @@ -2951,8 +2951,8 @@ def mode_inventorize_marked_hosts(options: Mapping[str, object]) -> None: def summarizer(host_name: HostName) -> CMKSummarizer: return CMKSummarizer( - config_cache, host_name, + config_cache.summary_config, override_non_ok_state=config_cache.hwsw_inventory_parameters(host_name).fail_status, )