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


Python ansible.constants方法代码示例

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


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

示例1: _load_ansible_config

# 需要导入模块: import ansible [as 别名]
# 或者: from ansible import constants [as 别名]
def _load_ansible_config(self, config):
        """Load ansible configuration from command-line."""
        option_names = ['ansible_inventory', 'ansible_host_pattern', 'ansible_connection', 'ansible_user',
                        'ansible_module_path', 'ansible_become', 'ansible_become_method', 'ansible_become_user',
                        'ansible_ask_become_pass', 'ansible_subset']

        kwargs = dict()

        # Load command-line supplied values
        for key in option_names:
            short_key = key[8:]
            kwargs[short_key] = config.getoption(key)

        # normalize ansible.ansible_become options
        kwargs['become'] = kwargs['become'] or ansible.constants.DEFAULT_BECOME
        kwargs['become_user'] = kwargs['become_user'] or ansible.constants.DEFAULT_BECOME_USER
        kwargs['ask_become_pass'] = kwargs['ask_become_pass'] or ansible.constants.DEFAULT_BECOME_ASK_PASS

        log.debug("config: %s" % kwargs)
        return kwargs 
开发者ID:ansible,项目名称:pytest-ansible,代码行数:22,代码来源:plugin.py

示例2: _make_secrets

# 需要导入模块: import ansible [as 别名]
# 或者: from ansible import constants [as 别名]
def _make_secrets(self, secret):
        if _ANSIBLE_VER < 2.4:
            return secret

        from ansible.constants import DEFAULT_VAULT_ID_MATCH
        from ansible.parsing.vault import VaultSecret

        return [(DEFAULT_VAULT_ID_MATCH, VaultSecret(secret))] 
开发者ID:tomoh1r,项目名称:ansible-vault,代码行数:10,代码来源:api.py

示例3: become_methods

# 需要导入模块: import ansible [as 别名]
# 或者: from ansible import constants [as 别名]
def become_methods():
    """Return string list of become methods available to ansible."""
    if become_loader:
        return [method.name for method in become_loader.all()]
    else:
        return ansible.constants.BECOME_METHODS 
开发者ID:ansible,项目名称:pytest-ansible,代码行数:8,代码来源:plugin.py


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