當前位置: 首頁>>代碼示例>>Python>>正文


Python config.SSHConfig方法代碼示例

本文整理匯總了Python中paramiko.config.SSHConfig方法的典型用法代碼示例。如果您正苦於以下問題:Python config.SSHConfig方法的具體用法?Python config.SSHConfig怎麽用?Python config.SSHConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在paramiko.config的用法示例。


在下文中一共展示了config.SSHConfig方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: parse_ssh_config

# 需要導入模塊: from paramiko import config [as 別名]
# 或者: from paramiko.config import SSHConfig [as 別名]
def parse_ssh_config(file_obj):
    """
    Provided only as a backward-compatible wrapper around `.SSHConfig`.
    """
    config = SSHConfig()
    config.parse(file_obj)
    return config 
開發者ID:ohmyadd,項目名稱:wetland,代碼行數:9,代碼來源:util.py

示例2: parse_ssh_config

# 需要導入模塊: from paramiko import config [as 別名]
# 或者: from paramiko.config import SSHConfig [as 別名]
def parse_ssh_config(file_obj):
    """
    Provided only as a backward-compatible wrapper around L{SSHConfig}.
    """
    config = SSHConfig()
    config.parse(file_obj)
    return config 
開發者ID:lycclsltt,項目名稱:watchmen,代碼行數:9,代碼來源:util.py

示例3: lookup_ssh_host_config

# 需要導入模塊: from paramiko import config [as 別名]
# 或者: from paramiko.config import SSHConfig [as 別名]
def lookup_ssh_host_config(hostname, config):
    """
    Provided only as a backward-compatible wrapper around L{SSHConfig}.
    """
    return config.lookup(hostname) 
開發者ID:lycclsltt,項目名稱:watchmen,代碼行數:7,代碼來源:util.py

示例4: _get_ssh_config

# 需要導入模塊: from paramiko import config [as 別名]
# 或者: from paramiko.config import SSHConfig [as 別名]
def _get_ssh_config(key):
    if not _ssh_config:

        ssh_config = SSHConfig()

        path = os.path.expanduser('~/.ssh/config')
        if os.path.exists(path):
            with open(path) as open_file:
                ssh_config.parse(open_file)

        # Create a fake hostname like "dev.myproject.ssha" to allow users to
        # set options in ~/.ssh/config based on the environment and project.
        hostname_parts = (get('config.name'), get('ssha.name'), 'ssha')
        hostname = '.'.join(filter(None, hostname_parts))

        result = ssh_config.lookup(hostname)

        if 'identityfile' not in result:
            result['identityfile'] = [
                '~/.ssh/id_rsa',
                '~/.ssh/id_dsa',
                '~/.ssh/id_ecdsa',
                '~/.ssh/id_ed25519',
            ]

        if 'user' not in result:
            user = os.environ.get('USER')
            if user:
                result['user'] = user

        _ssh_config.update(result)

    return _ssh_config.get(key, []) 
開發者ID:claranet,項目名稱:ssha,代碼行數:35,代碼來源:config.py

示例5: lookup_ssh_host_config

# 需要導入模塊: from paramiko import config [as 別名]
# 或者: from paramiko.config import SSHConfig [as 別名]
def lookup_ssh_host_config(hostname, config):
    """
    Provided only as a backward-compatible wrapper around `.SSHConfig`.
    """
    return config.lookup(hostname) 
開發者ID:summerwinter,項目名稱:SublimeRemoteGDB,代碼行數:7,代碼來源:util.py


注:本文中的paramiko.config.SSHConfig方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。