dbrestore.py 文件源码

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

项目:tools 作者: apertoso 项目源码 文件源码
def get_db_host():
    # first try to look for a loopback alias addr
    loopback_addr = get_lo_alias_addr()
    if loopback_addr:
        return loopback_addr

    # if we did not find any IP on the loopback if, find the
    # interface of the default gateway and use that.
    try:
        default_if = netifaces.gateways().get('default', {}).values()[0][1]
        if_addr = netifaces.ifaddresses(default_if)[netifaces.AF_INET][0].get(
            'addr')
        return if_addr
    except KeyError:
        raise Exception('Cannot find DB address for the current host')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号