Changeset 1976


Ignore:
Timestamp:
Jan 12, 2009, 9:27:39 PM (16 years ago)
Author:
quentin
Message:

Show hostnames for every NIC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-web/code/main.py

    r1964 r1976  
    270270    XXX this should be merged with the similar logic in DNS and DHCP.
    271271    """
    272     if nic.hostname and '.' in nic.hostname:
    273         return nic.hostname
     272    if nic.hostname:
     273        hostname = nic.hostname
    274274    elif nic.machine:
    275         return nic.machine.name + '.' + config.dns.domains[0]
     275        hostname = nic.machine.name
    276276    else:
    277277        return None
    278 
     278    if '.' in hostname:
     279        return hostname
     280    else:
     281        return hostname + '.' + config.dns.domains[0]
    279282
    280283def getNicInfo(data_dict, machine):
     
    292295    for i in range(len(machine.nics)):
    293296        nic_fields.extend([(x % i, y % i) for x, y in nic_fields_template])
    294         if not i:
    295             data_dict['nic%s_hostname' % i] = getHostname(machine.nics[i])
     297        data_dict['nic%s_hostname' % i] = getHostname(machine.nics[i])
    296298        data_dict['nic%s_mac' % i] = machine.nics[i].mac_addr
    297299        data_dict['nic%s_ip' % i] = machine.nics[i].ip
Note: See TracChangeset for help on using the changeset viewer.