Example #1
0
def connected_start():
    global conn_list

    ip = nm.get_active_ip()
    mdns.add_hosts(dns_names, ip)

    conn_list = []
Example #2
0
def hotspot_pass():
    log.debug("Activating mdns")

    # IP tolerance for PI 2
    for _ in range(5):
        ip = nm.get_active_ip(modemgr.get_state_device('HOTSPOT'))
        if ip:
            mdns.clear_entries()
            mdns.add_hosts(dns_names)
            break
        time.sleep(1)
Example #3
0
def connected_start():
    global conn_list

    # IP tolerance for PI 2
    for _ in range(5):
        ip = nm.get_active_ip(modemgr.get_state_device('CONNECTED'))
        if ip:
            mdns.clear_entries()
            mdns.add_hosts(dns_names)
            break
        time.sleep(1)

    conn_list = []
Example #4
0
def add_hosts(hosts):
    establish_group()

    i = 0
    for device in nm.get_devices():
        i += 1
        name = nm.device_name(device)
        addr = nm.get_active_ip(device)
        if (name in nm.get_phys_dev_names()) and addr:
            for host in hosts:
                make_a_record(host, i, addr)

            add_service(hosts[0], i, addr)

    group.Commit()
Example #5
0
def add_hosts(hosts):
    establish_group()
    int_mapping = get_interface_mapping()

    for device in nm.get_devices():
        name = nm.device_name(device)
        addr = nm.get_active_ip(device)
        if (name in nm.get_phys_dev_names() and name in int_mapping and addr):

            index = int_mapping[name]
            for host in hosts:
                make_a_record(host, index, addr)

            add_service(hosts[0], index, addr)

    group.Commit()
Example #6
0
def hotspot_pass():
    log.debug("Activating mdns")

    ip = nm.get_active_ip()
    mdns.add_hosts(dns_names, ip)