forked from Checkmk/checkmk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkp
executable file
·79 lines (69 loc) · 2.73 KB
/
mkp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env -S python3 -P
# Copyright (C) 2019 Checkmk 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.
import sys
from typing import Final
import cmk.ccc.store
from cmk.ccc.version import __version__, parse_check_mk_version
import cmk.utils.paths
from cmk.utils.setup_search_index import request_index_rebuild
from cmk.utils.visuals import invalidate_visuals_cache
import cmk.ec.export as ec # pylint: disable=cmk-module-layer-violation
from cmk.discover_plugins import addons_plugins_local_path, plugins_local_path
from cmk.mkp_tool import (
cli,
make_post_package_change_actions,
PackageStore,
PathConfig,
reload_services_affected_by_mkp_changes,
)
_PATH_CONFIG = PathConfig(
cmk_plugins_dir=plugins_local_path(),
cmk_addons_plugins_dir=addons_plugins_local_path(),
agent_based_plugins_dir=cmk.utils.paths.local_agent_based_plugins_dir,
agents_dir=cmk.utils.paths.local_agents_dir,
alert_handlers_dir=cmk.utils.paths.local_alert_handlers_dir,
bin_dir=cmk.utils.paths.local_bin_dir,
check_manpages_dir=cmk.utils.paths.local_legacy_check_manpages_dir,
checks_dir=cmk.utils.paths.local_checks_dir,
doc_dir=cmk.utils.paths.local_doc_dir,
gui_plugins_dir=cmk.utils.paths.local_gui_plugins_dir,
installed_packages_dir=cmk.utils.paths.installed_packages_dir,
inventory_dir=cmk.utils.paths.local_inventory_dir,
lib_dir=cmk.utils.paths.local_lib_dir,
locale_dir=cmk.utils.paths.local_locale_dir,
local_root=cmk.utils.paths.local_root,
mib_dir=cmk.utils.paths.local_mib_dir,
mkp_rule_pack_dir=ec.mkp_rule_pack_dir(),
notifications_dir=cmk.utils.paths.local_notifications_dir,
pnp_templates_dir=cmk.utils.paths.local_pnp_templates_dir,
manifests_dir=cmk.utils.paths.tmp_dir,
web_dir=cmk.utils.paths.local_web_dir,
)
_SITE_CONTEXT: Final = cli.SiteContext(
PackageStore(
enabled_dir=cmk.utils.paths.local_enabled_packages_dir,
local_dir=cmk.utils.paths.local_optional_packages_dir,
shipped_dir=cmk.utils.paths.optional_packages_dir,
),
callbacks=ec.mkp_callbacks(),
post_package_change_actions=make_post_package_change_actions(
on_any_change=(
reload_services_affected_by_mkp_changes,
invalidate_visuals_cache,
request_index_rebuild,
)
),
version=__version__,
parse_version=parse_check_mk_version,
)
if __name__ == "__main__":
sys.exit(
cli.main(
sys.argv[1:] or ["--help"],
_PATH_CONFIG,
_SITE_CONTEXT,
cmk.ccc.store.save_bytes_to_file,
)
)