當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。