コード例 #1
0
ファイル: main.py プロジェクト: gradecke/checkmk
def run(arguments: argparse.Namespace, old_site_id: SiteId,
        new_site_id: SiteId) -> bool:
    has_errors = False
    logger.debug("Initializing application...")
    with application_and_request_context(), SuperUserContext():
        initialize_gui_environment()

        logger.debug("Starting actions...")
        actions = sorted(rename_action_registry.values(),
                         key=lambda a: a.sort_index)
        total = len(actions)
        for count, rename_action in enumerate(actions, start=1):
            logger.log(VERBOSE, " %i/%i %s...", count, total,
                       rename_action.title)
            try:
                rename_action.run(old_site_id, new_site_id)
            except Exception:
                has_errors = True
                logger.error(' + "%s" failed',
                             rename_action.title,
                             exc_info=True)
                if arguments.debug:
                    raise

    logger.log(VERBOSE, "Done")
    return has_errors
コード例 #2
0
ファイル: update_config.py プロジェクト: tklecker/checkmk
    def _initialize_gui_environment(self):
        self._logger.log(VERBOSE, "Loading GUI plugins...")

        # TODO: We are about to rewrite parts of the config. Would be better to be executable without
        # loading the configuration first (because the load_config() may miss some conversion logic
        # which is only known to cmk.update_config in the future).
        initialize_gui_environment()

        failed_plugins = cmk.gui.utils.get_failed_plugins()
        if failed_plugins:
            self._logger.error("")
            self._logger.error("ERROR: Failed to load some GUI plugins. You will either have \n"
                               "       to remove or update them to be compatible with this \n"
                               "       Checkmk version.")
            self._logger.error("")
コード例 #3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2021 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
"""Initialize the Checkmk default configuration in case it is necessary.
"""
# pylint: disable=cmk-module-layer-violation
from cmk.gui import watolib
from cmk.gui.utils.script_helpers import application_and_request_context, initialize_gui_environment

if __name__ == "__main__":
    with application_and_request_context():
        initialize_gui_environment()
        watolib.init_wato_datastructures()