def _save_gui_groups(all_groups: AllGroupSpecs, config_dir: str) -> None: multisite_groups: Dict[GroupType, Dict[GroupName, GroupSpec]] = {} for group_type, groups in all_groups.items(): for gid, group in groups.items(): for attr, value in group.items(): if attr != "alias": # Saved in cmk_base multisite_groups.setdefault(group_type, {}) multisite_groups[group_type].setdefault(gid, {}) multisite_groups[group_type][gid][attr] = value store.makedirs(config_dir) output = wato_fileheader() for what in get_args(GroupType): if multisite_groups.get(what): output += "multisite_%sgroups = \\\n%s\n\n" % ( what, format_config_value(multisite_groups[what]), ) store.save_text_to_file("%s/groups.mk" % config_dir, output)
def _save_cmk_base_groups(all_groups: AllGroupSpecs, config_dir: str) -> None: check_mk_groups: Dict[GroupType, Dict[GroupName, str]] = {} for group_type, groups in all_groups.items(): check_mk_groups[group_type] = {} for gid, group in groups.items(): check_mk_groups[group_type][gid] = group["alias"] # Save Checkmk world related parts store.makedirs(config_dir) output = wato_fileheader() for group_type in get_args(GroupType): if check_mk_groups.get(group_type): output += "if type(define_%sgroups) != dict:\n define_%sgroups = {}\n" % ( group_type, group_type, ) output += "define_%sgroups.update(%s)\n\n" % ( group_type, format_config_value(check_mk_groups[group_type]), ) store.save_text_to_file("%s/groups.mk" % config_dir, output)