(configured_ifs)
return None
try to return a right interface so that iftop can listen on
try to return a right interface so that iftop can listen on
try to return a right interface so that iftop can listen on
def try_to_get_right_interface(configured_ifs):
    """ try to return a right interface so that iftop can listen on """
    ifs = get_interfaces()

    logger.debug("found interfaces %s", ifs)

    for interface in configured_ifs.split(","):
        interface = interface.strip()
        if interface in ifs:
            return interface

    logger.info("didn't find correct network interface in this node, configured %s, found %s",
            configured_ifs, ifs)

    ip = get_ip_can_access_internet()
    if ip is not None:
        for if_name, if_ip in ifs.items():
            if ip == if_ip:
                return if_name

    return None
def try_to_get_right_interface ( configured_ifs ) : ifs = get_interfaces ( ) logger . debug ( "found interfaces %s" , ifs ) for interface in configured_ifs . split ( "," ) : interface = interface . strip ( ) if interface in ifs : return interface logger . info ( "didn't find correct network interface in this node, configured %s, found %s" , configured_ifs , ifs ) ip = get_ip_can_access_internet ( ) if ip is not None : for if_name , if_ip in ifs . items ( ) : if ip == if_ip : return if_name return None