path.py 文件源码

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

项目:python-don 作者: openstack 项目源码 文件源码
def process_ping(filename, ip=None, check_ssh_connectivity_only=False):
    if not os.path.isfile(filename):
        return False

    status_update('Trying to read ' + filename)
    with open(filename) as f:
        lines = f.readlines()
    pprint.pprint(lines)

    info = load_json(filename)
    if not check_ssh_connectivity_only:
        return info.get('pass', False)

    cmd_list = info['command_list']
    for cmd in cmd_list:
        m = re.search(
            'ssh (\S+) with provided username and passwd', cmd['cmd'])
        if m:
            if ip == m.group(1):
                return cmd['pass']
    return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号