vagrant.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:ansible-illumos-modules 作者: xen0l 项目源码 文件源码
def get_a_ssh_config(box_name):
    """Gives back a map of all the machine's ssh configurations"""

    output = subprocess.check_output(["vagrant", "ssh-config", box_name])
    config = SSHConfig()
    config.parse(StringIO(output))
    host_config = config.lookup(box_name)

    # man 5 ssh_config:
    # > It is possible to have multiple identity files ...
    # > all these identities will be tried in sequence.
    for id in host_config['identityfile']:
        if os.path.isfile(id):
            host_config['identityfile'] = id

    return dict((v, host_config[k]) for k, v in _ssh_to_ansible)

# List out servers that vagrant has running
# ------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号