当前位置: 首页>>代码示例>>Python>>正文


Python display.Display方法代码示例

本文整理汇总了Python中ansible.utils.display.Display方法的典型用法代码示例。如果您正苦于以下问题:Python display.Display方法的具体用法?Python display.Display怎么用?Python display.Display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ansible.utils.display的用法示例。


在下文中一共展示了display.Display方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pytest_configure

# 需要导入模块: from ansible.utils import display [as 别名]
# 或者: from ansible.utils.display import Display [as 别名]
def pytest_configure(config):
    """Validate --ansible-* parameters."""
    log.debug("pytest_configure() called")

    config.addinivalue_line("markers", "ansible(**kwargs): Ansible integration")

    # Enable connection debugging
    if config.option.verbose > 0:
        if hasattr(ansible.utils, 'VERBOSITY'):
            ansible.utils.VERBOSITY = int(config.option.verbose)
        else:
            from ansible.utils.display import Display
            display = Display()
            display.verbosity = int(config.option.verbose)

    assert config.pluginmanager.register(PyTestAnsiblePlugin(config), "ansible") 
开发者ID:ansible,项目名称:pytest-ansible,代码行数:18,代码来源:plugin.py

示例2: v2_playbook_on_task_start

# 需要导入模块: from ansible.utils import display [as 别名]
# 或者: from ansible.utils.display import Display [as 别名]
def v2_playbook_on_task_start(self, task, is_conditional):
        self._display.banner("TASK [%s]" % task.get_name().strip())
        # Display current time
        self._display.display("%s" % datetime.now().strftime('%A %d %B %Y  %H:%M:%S.%f '))

        if self._display.verbosity > 2:
            path = task.get_path()
            if path:
                self._display.display("task path: %s" %
                                      path, color='dark gray') 
开发者ID:grycap,项目名称:im,代码行数:12,代码来源:ansible_executor_v2.py

示例3: display

# 需要导入模块: from ansible.utils import display [as 别名]
# 或者: from ansible.utils.display import Display [as 别名]
def display(*args, **kwargs):
    """Set up display function for Ansible v2"""
    display_instance = Display()
    display_instance.display(*args, **kwargs)


# Set to minimum required Ansible version 
开发者ID:openshift,项目名称:openshift-ansible,代码行数:9,代码来源:aa_version_requirement.py

示例4: __init__

# 需要导入模块: from ansible.utils import display [as 别名]
# 或者: from ansible.utils.display import Display [as 别名]
def __init__(self, data_loader, inventory_manager, variable_manager, playbook_filename, options, graph=None):
        """
        Main grapher responsible to parse the playbook and draw graph
        :param data_loader:
        :type data_loader: ansible.parsing.dataloader.DataLoader
        :param inventory_manager:
        :type inventory_manager: ansible.inventory.manager.InventoryManager
        :param variable_manager:
        :type variable_manager: ansible.vars.manager.VariableManager
        :param options Command line options
        :type options: optparse.Values
        :param playbook_filename:
        :type playbook_filename: str
        :param graph:
        :type graph: Digraph
        """
        self.options = options
        self.variable_manager = variable_manager
        self.inventory_manager = inventory_manager
        self.data_loader = data_loader
        self.playbook_filename = playbook_filename
        self.options.output_filename = self.options.output_filename
        self.rendered_file_path = None
        self.display = Display(verbosity=options.verbosity)

        if self.options.tags is None:
            self.options.tags = ["all"]

        if self.options.skip_tags is None:
            self.options.skip_tags = []

        self.graph_representation = GraphRepresentation()

        self.playbook = Playbook.load(self.playbook_filename, loader=self.data_loader,
                                      variable_manager=self.variable_manager)

        if graph is None:
            self.graph = CustomDigrah(edge_attr=self.DEFAULT_EDGE_ATTR, graph_attr=self.DEFAULT_GRAPH_ATTR,
                                      format="svg") 
开发者ID:haidaraM,项目名称:ansible-playbook-grapher,代码行数:41,代码来源:grapher.py

示例5: ansible_playbook

# 需要导入模块: from ansible.utils import display [as 别名]
# 或者: from ansible.utils.display import Display [as 别名]
def ansible_playbook(inventory, playbook_path, verbose=None,
                     extra_vars=None, ansible_args=None):
    """Wraps the 'ansible-playbook' CLI.

     :param inventory: inventory file to use.
     :param playbook_path: the playbook to invoke
     :param verbose: Ansible verbosity level
     :param extra_vars: dict. Passed to Ansible as extra-vars
     :param ansible_args: dict of ansible-playbook arguments to plumb down
         directly to Ansible.
    """
    ansible_args = ansible_args or []
    LOG.debug("Additional ansible args: {}".format(ansible_args))

    # hack for verbosity
    from ansible.utils.display import Display
    display = Display(verbosity=verbose)
    import __main__ as main
    setattr(main, "display", display)

    # TODO(yfried): Use proper ansible API instead of emulating CLI
    cli_args = ['execute',
                playbook_path,
                '--inventory', inventory]

    # infrared should not change ansible verbosity unless user specifies that
    if verbose:
        cli_args.append('-' + 'v' * int(verbose))

    cli_args.extend(ansible_args)

    results = _run_playbook(cli_args,
                            vars_dict=extra_vars or {})

    if results:
        LOG.error('Playbook "%s" failed!' % playbook_path)
    return results 
开发者ID:redhat-openstack,项目名称:infrared,代码行数:39,代码来源:execute.py

示例6: test_single_display_module

# 需要导入模块: from ansible.utils import display [as 别名]
# 或者: from ansible.utils.display import Display [as 别名]
def test_single_display_module():
    assert sum(1 for obj in gc.get_objects() if isinstance(obj, Display)) == 1 
开发者ID:seantis,项目名称:suitable,代码行数:4,代码来源:test_api.py

示例7: __init__

# 需要导入模块: from ansible.utils import display [as 别名]
# 或者: from ansible.utils.display import Display [as 别名]
def __init__(self, playbook, inventory, run_data=None, verbosity=0, tags=None, skip_tags=None):
        self.run_data = run_data or {}
        self.options = Options()

        self.options.verbosity = verbosity
        self.options.connection = 'local'  # Need a connection type "smart" or "ssh"
        self.options.become = True
        self.options.become_method = 'sudo'
        self.options.become_user = 'root'
        self.options.tags = tags or []
        self.options.skip_tags = skip_tags or []
        # Set global verbosity
        self.display = Display()
        self.display.verbosity = self.options.verbosity
        # Executor appears to have it's own
        # verbosity object/setting as well
        playbook_executor.verbosity = self.options.verbosity

        # Become Pass Needed if not logging in as user root
        passwords = {}

        # Gets data from YAML/JSON files
        self.loader = DataLoader()
        self.loader.set_vault_password(os.environ.get('VAULT_PASS',''))

        # All the variables from all the various places
        self.variable_manager = VariableManager()
        self.variable_manager.extra_vars = self.run_data

        self.inventory = Inventory(loader=self.loader, variable_manager=self.variable_manager, host_list=inventory)
        self.variable_manager.set_inventory(self.inventory)

        # Setup playbook executor, but don't run until run() called
        self.pbex = playbook_executor.PlaybookExecutor(
            playbooks=[playbook],
            inventory=self.inventory,
            variable_manager=self.variable_manager,
            loader=self.loader,
            options=self.options,
            passwords=passwords) 
开发者ID:Juniper,项目名称:contrail-docker,代码行数:42,代码来源:runner.py


注:本文中的ansible.utils.display.Display方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。