Пример #1
0
def run_grapher(playbook_path, output_filename=None, additional_args=None):
    """
    Utility function to run the grapher
    :param output_filename:
    :type output_filename: str
    :param additional_args:
    :type additional_args: list
    :param playbook_path:
    :type playbook_path: str
    :return:
    :rtype:
    """
    additional_args = additional_args or []
    args = [__prog__]

    if output_filename:  # the default filename is the playbook file name minus .yml
        # put the generated svg in a dedicated folder
        dir_path = os.path.dirname(os.path.realpath(__file__))  # current file directory
        args.extend(['-o', os.path.join(dir_path, "generated_svg", output_filename)])

    args.extend(additional_args)

    args.append(playbook_path)

    cli = PlaybookGrapherCLI(args)

    cli.parse()

    return cli.run()
Пример #2
0
def run_grapher(args):
    cli = PlaybookGrapherCLI(args)

    cli.parse()

    return cli.run()