コード例 #1
0
ファイル: global_settings.py プロジェクト: LinuxHaus/checkmk
 def _config_variable_to_match_item(
     self,
     config_variable: ConfigVariable,
     edit_mode_name: str,
 ) -> MatchItem:
     title = config_variable.valuespec().title() or _("Untitled setting")
     ident = config_variable.ident()
     return MatchItem(
         title=title,
         topic=self._topic,
         url=makeuri_contextless(
             request,
             [("mode", edit_mode_name), ("varname", ident)],
             filename="wato.py",
         ),
         match_texts=[title, ident],
     )
コード例 #2
0
    def _should_show_config_variable(self, config_variable: ConfigVariable) -> bool:
        varname = config_variable.ident()

        if not config_variable.domain().enabled():
            return False

        if config_variable.domain(
        ) == watolib.ConfigDomainCore and varname not in self._default_values:
            if config.debug:
                raise MKGeneralException("The configuration variable <tt>%s</tt> is unknown to "
                                         "your local Check_MK installation" % varname)
            return False

        if not config_variable.in_global_settings():
            return False

        return True