コード例 #1
0
def test_unpackaged_files():
    _create_test_file("abc")

    p = cmk.utils.paths.local_doc_dir.joinpath("docxx")
    with p.open("w", encoding="utf-8") as f:
        f.write(u"lala\n")

    p = cmk.utils.paths.local_agent_based_plugins_dir.joinpath("dada")
    with p.open("w", encoding="utf-8") as f:
        f.write(u"huhu\n")

    assert packaging.unpackaged_files() == {
        'agent_based': ['dada'],
        'agents': [],
        'alert_handlers': [],
        'bin': [],
        'checkman': [],
        'checks': ['abc'],
        'doc': ["docxx"],
        'ec_rule_packs': [],
        'inventory': [],
        'lib': [],
        'locales': [],
        'mibs': [],
        'notifications': [],
        'pnp-templates': [],
        'web': [],
    }
コード例 #2
0
ファイル: test_packaging.py プロジェクト: Yogibaer75/checkmk
def test_unpackaged_files():
    _create_test_file("abc")

    p = cmk.utils.paths.local_doc_dir.joinpath("docxx")
    with p.open("w", encoding="utf-8") as f:
        f.write("lala\n")

    p = cmk.utils.paths.local_agent_based_plugins_dir.joinpath("dada")
    with p.open("w", encoding="utf-8") as f:
        f.write("huhu\n")

    assert {
        part.ident: files
        for part, files in packaging.unpackaged_files().items()
    } == {
        "agent_based": ["dada"],
        "agents": [],
        "alert_handlers": [],
        "bin": [],
        "checkman": [],
        "checks": ["abc"],
        "doc": ["docxx"],
        "ec_rule_packs": [],
        "inventory": [],
        "lib": [],
        "locales": [],
        "mibs": [],
        "notifications": [],
        "pnp-templates": [],
        "web": [],
        "gui": [],
    }
コード例 #3
0
def test_unpackaged_files_none():
    assert packaging.unpackaged_files() == {
        'agents': [],
        'alert_handlers': [],
        'bin': [],
        'checkman': [],
        'checks': [],
        'doc': [],
        'ec_rule_packs': [],
        'inventory': [],
        'lib': [],
        'locales': [],
        'mibs': [],
        'notifications': [],
        'pnp-templates': [],
        'web': [],
    }
コード例 #4
0
def test_unpackaged_files_none():
    assert {part.ident: files for part, files in packaging.unpackaged_files().items()} == {
        "agent_based": [],
        "agents": [],
        "alert_handlers": [],
        "bin": [],
        "checkman": [],
        "checks": [],
        "doc": [],
        "ec_rule_packs": [],
        "inventory": [],
        "lib": [],
        "locales": [],
        "mibs": [],
        "notifications": [],
        "pnp-templates": [],
        "web": [],
    }
コード例 #5
0
def test_unpackaged_files_none():
    assert {
        part.ident: files
        for part, files in packaging.unpackaged_files().items()
    } == {
        'agent_based': [],
        'agents': [],
        'alert_handlers': [],
        'bin': [],
        'checkman': [],
        'checks': [],
        'doc': [],
        'ec_rule_packs': [],
        'inventory': [],
        'lib': [],
        'locales': [],
        'mibs': [],
        'notifications': [],
        'pnp-templates': [],
        'web': [],
    }
コード例 #6
0
ファイル: packaging.py プロジェクト: gradecke/checkmk
def package_find(_no_args: List[str]) -> None:
    visited: AbstractSet[Path] = set()
    for part, files in unpackaged_files().items():
        if files:
            if not visited:
                logger.log(VERBOSE, "Unpackaged files:")

            found = frozenset(
                Path(part.path) / f for f in files
                if (Path(part.path) / f).resolve() not in visited)
            if found:
                logger.log(VERBOSE, "  %s%s%s:", tty.bold, part.title,
                           tty.normal)
            for p in found:
                if logger.isEnabledFor(VERBOSE):
                    logger.log(VERBOSE, "    %s", p.relative_to(part.path))
                else:
                    logger.info("%s", p)
            visited |= {p.resolve() for p in found}

    if not visited:
        logger.log(VERBOSE, "No unpackaged files found.")