Changeset 11739 in genesis for tools


Ignore:
Timestamp:
Feb 14, 2013, 9:56:21 AM (12 years ago)
Author:
rick
Message:

Grumble aliases on DHCP interfaces proved to be a interesting challenge.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r11738 r11739  
    587587
    588588    # Flag dhclient is possible
    589     if not dhclient_if[ifname]:
     589    if not dhclient_if.has_key(ifname) or dhclient_if[ifname] == False:
    590590      dhclient_if[ifname] = dhcp_type(ifacedump) == DHCP_CLIENT
    591591
     
    824824    if dhclient_if[iface]:
    825825      output += "ifconfig_%s='SYNCDHCP'\n\n" % (iface)
    826     else:
    827       # Make sure the external address is always first as this is needed in the
    828       # firewall setup
    829       addrs = sorted(addrs,key=lambda x: x[0].split('.')[0], cmp=lambda x,y: cmp(1 if x == '172' else 0, 1 if y == '172' else 0))
    830       output += "ipv4_addrs_%s='%s'\n\n" % (iface, " ".join([x[0] for x in addrs]))
     826   
     827    # Make sure the external address is always first as this is needed in the
     828    # firewall setup
     829    addrs = sorted(
     830        [x for x in addrs if not '0.0.0.0' in x[0]],
     831        key=lambda x: x[0].split('.')[0],
     832        cmp=lambda x,y: cmp(1 if x == '172' else 0, 1 if y == '172' else 0)
     833      )
     834    addr_str = " ".join([x[0] for x in addrs])
     835    output += "ipv4_addrs_%s='%s'\n\n" % (iface, addr_str)
    831836
    832837  rc_conf_local_cache[datadump['autogen_item']] = output
Note: See TracChangeset for help on using the changeset viewer.