def get_replication_paths(): paths = [ ("dir", "check_mk", cmk.gui.watolib.utils.wato_root_dir(), ["sitespecific.mk"]), ("dir", "multisite", cmk.gui.watolib.utils.multisite_dir(), ["sitespecific.mk"]), ("file", "htpasswd", cmk.utils.paths.htpasswd_file), ("file", "auth.secret", '%s/auth.secret' % os.path.dirname(cmk.utils.paths.htpasswd_file)), ("file", "auth.serials", '%s/auth.serials' % os.path.dirname(cmk.utils.paths.htpasswd_file)), # Also replicate the user-settings of Multisite? While the replication # as such works pretty well, the count of pending changes will not # know. ("dir", "usersettings", cmk.utils.paths.var_dir + "/web", ["*/report-thumbnails"]), ("dir", "mkps", cmk.utils.paths.var_dir + "/packages"), ("dir", "local", cmk.utils.paths.omd_root + "/local"), ] # TODO: Move this to CEE specific code again if not cmk_version.is_raw_edition(): paths += [ ("dir", "liveproxyd", cmk.gui.watolib.utils.liveproxyd_config_dir(), ["sitespecific.mk"]), ] # Include rule configuration into backup/restore/replication. Current # status is not backed up. if config.mkeventd_enabled: _rule_pack_dir = str(ec.rule_pack_dir()) paths.append(("dir", "mkeventd", _rule_pack_dir, ["sitespecific.mk"])) _mkp_rule_pack_dir = str(ec.mkp_rule_pack_dir()) paths.append(("dir", "mkeventd_mkp", _mkp_rule_pack_dir)) return paths + _replication_paths
def _get_permissions(path: str) -> int: """Determine permissions by the first matching beginning of 'path'""" # order matters! See function _get_permissions perm_map = ( (cmk.utils.paths.checks_dir, 0o644), (str(cmk.utils.paths.local_checks_dir), 0o644), (str(cmk.utils.paths.notifications_dir), 0o755), (str(cmk.utils.paths.local_notifications_dir), 0o755), (cmk.utils.paths.inventory_dir, 0o644), (str(cmk.utils.paths.local_inventory_dir), 0o644), (cmk.utils.paths.check_manpages_dir, 0o644), (str(cmk.utils.paths.local_check_manpages_dir), 0o644), (cmk.utils.paths.agents_dir, 0o755), (str(cmk.utils.paths.local_agents_dir), 0o755), (cmk.utils.paths.web_dir, 0o644), (str(cmk.utils.paths.local_web_dir), 0o644), (str(cmk.utils.paths.pnp_templates_dir), 0o644), (str(cmk.utils.paths.local_pnp_templates_dir), 0o644), (str(cmk.utils.paths.doc_dir), 0o644), (str(cmk.utils.paths.local_doc_dir), 0o644), (str(cmk.utils.paths.locale_dir), 0o644), (str(cmk.utils.paths.local_locale_dir), 0o644), (str(cmk.utils.paths.local_bin_dir), 0o755), (str(cmk.utils.paths.local_lib_dir / "nagios" / "plugins"), 0o755), (str(cmk.utils.paths.local_lib_dir), 0o644), (str(cmk.utils.paths.local_mib_dir), 0o644), (os.path.join(cmk.utils.paths.share_dir, "alert_handlers"), 0o755), (str(cmk.utils.paths.local_share_dir / "alert_handlers"), 0o755), (str(ec.mkp_rule_pack_dir()), 0o644), ) for path_begin, perm in perm_map: if path.startswith(path_begin): return perm raise PackageException("could not determine permissions for %r" % path)
def get_config_parts() -> List[PackagePart]: return [ PackagePart("ec_rule_packs", _("Event Console rule packs"), str(ec.mkp_rule_pack_dir())), ]
(str(cmk.utils.paths.local_agents_dir), 0o755), (cmk.utils.paths.web_dir, 0o644), (str(cmk.utils.paths.local_web_dir), 0o644), (str(cmk.utils.paths.pnp_templates_dir), 0o644), (str(cmk.utils.paths.local_pnp_templates_dir), 0o644), (str(cmk.utils.paths.doc_dir), 0o644), (str(cmk.utils.paths.local_doc_dir), 0o644), (str(cmk.utils.paths.locale_dir), 0o644), (str(cmk.utils.paths.local_locale_dir), 0o644), (str(cmk.utils.paths.local_bin_dir), 0o755), (str(cmk.utils.paths.local_lib_dir / "nagios" / "plugins"), 0o755), (str(cmk.utils.paths.local_lib_dir), 0o644), (str(cmk.utils.paths.local_mib_dir), 0o644), (os.path.join(cmk.utils.paths.share_dir, "alert_handlers"), 0o755), (str(cmk.utils.paths.local_share_dir / "alert_handlers"), 0o755), (str(ec.mkp_rule_pack_dir()), 0o644), ) def _get_permissions(path): # type: (str) -> int """Determine permissions by the first matching beginning of 'path'""" for path_begin, perm in PERM_MAP: if path.startswith(path_begin): return perm raise PackageException("could not determine permissions for %r" % path) PackageName = str PartName = str PartPath = str