コード例 #1
0
def test_regular_werks(site):
    werks = cmk.utils.werks.load()

    regular_werks = [
        werk for werk in werks.values() if werk["edition"] == "cre"
    ]

    assert len(regular_werks) > 1000
コード例 #2
0
def test_managed_werks(site: Site):
    werks = cmk.utils.werks.load()

    managed_werks = [werk for werk in werks.values() if werk["edition"] == "cme"]

    if site.version.edition() != "managed":
        assert not managed_werks
    else:
        assert managed_werks
コード例 #3
0
def test_enterprise_werks(site: Site):
    werks = cmk.utils.werks.load()

    enterprise_werks = [werk for werk in werks.values() if werk["edition"] == "cee"]

    if site.version.edition() == "raw":
        assert not enterprise_werks
    else:
        assert enterprise_werks
コード例 #4
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 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.

import sys
from pathlib import Path
import cmk.utils.werks

werk_dir = Path(sys.argv[1])
dest_file = Path(sys.argv[2])
edition_short = sys.argv[3] if len(sys.argv) > 3 else None

if not werk_dir.exists():
    raise Exception("Requested werk directory does not exist: %s" % werk_dir)

werks = cmk.utils.werks.load_raw_files(werk_dir)

if edition_short:
    werks = {
        werk["id"]: werk  #
        for werk in werks.values() if werk["edition"] == edition_short
    }

cmk.utils.werks.write_precompiled_werks(dest_file, werks)