def _parse_raw_data(self, section: SectionPlugin) -> Any: # yes *ANY* try: raw_data = self._host_sections.sections[section.name] except KeyError: return None try: return section.parse_function(raw_data) except Exception: if cmk.utils.debug.enabled(): raise self._parsing_errors.append( create_section_crash_dump( operation="parsing", section_name=section.name, section_content=raw_data, )) return None
def _get_parsing_result( self, host_key: HostKey, section: SectionPlugin, ) -> Any: # lookup the parsing result in the cache, it might have been computed # during resolving of the supersedings (or set to None b/c the section # *is* superseeded) cache_key = host_key + (section.name,) if cache_key in self._parsing_results: return self._parsing_results[cache_key] try: data = self[host_key].sections[section.name] except KeyError: return self._parsing_results.setdefault(cache_key, None) return self._parsing_results.setdefault(cache_key, section.parse_function(data))
def _get_empty_parsed_result(section: SectionPlugin) -> object: return section.parse_function( len(section.trees) * [[]] # type: ignore[arg-type] ) if isinstance(section, SNMPSectionPlugin) else None
def _parse_raw_data(self, section: SectionPlugin) -> Any: # yes *ANY* try: raw_data = self._host_sections.sections[section.name] except KeyError: return None return section.parse_function(raw_data)