How to use the citellus.docitellus function in citellus

To help you get started, we’ve selected a few citellus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github citellusorg / citellus / citellus / magui.py View on Github external
def callcitellus(path=False, plugins=False):
    """
    Do actual execution of citellus against data
    :param path: sosreport path
    :param plugins: plugins enabled as provided to citellus
    :return: dict with results
    """

    # Call citellus and format data returned
    results = citellus.docitellus(path=path, plugins=plugins)

    # Process plugin output from multiple plugins
    new_dict = {}
    for item in results:
        name = item['plugin']
        new_dict[name] = item
    return new_dict
github citellusorg / citellus / citellus / extensions / ansible-playbook.py View on Github external
if options.live is True:
        for playbook in playbooksnap:
            if citellus.regexpfile(file=playbook, regexp="CITELLUS_HYBRID"):
                # Add to the list of playbooks to run
                playbooks.append(playbook)

                # Remove from the skipped playbooks
                playbookskipped.remove(playbook)

    commands = []
    ansible = which("ansible-playbook")
    for playbook in playbooks:
        commands.append("%s -i localhost --connection=local, %s" % (ansible, playbook))

    # Actually run the tests
    results = citellus.docitellus(live=options.live, path=None, plugins=commands, lang='en_US')

    # Do formatting of results to remove ansible-playbook -i localhost, and adjust return codes to citellus standards
    for result in results:
        # Convert RC codes to what citellus expects
        if result['result']['rc'] == 2:
            result['result']['rc'] = citellus.RC_FAILED
        elif result['result']['rc'] == 0:
            result['result']['rc'] = citellus.RC_OKAY

        # Convert stdout to stderr for citellus handling
        result['result']['err'] = result['result']['out']
        result['result']['out'] = ''

        # Remove ansible-playbook command and just leave yml file
        result['plugin'] = result['plugin'].replace(which('ansible-playbook'), '').replace(' -i localhost --connection=local, ', '')

citellus

Utility for running set of tests against a Live System or a snapshot/sosreport

GPL-3.0
Latest version published 4 years ago

Package Health Score

57 / 100
Full package analysis

Similar packages