Changeset 10734 in genesis


Ignore:
Timestamp:
May 8, 2012, 11:11:48 PM (13 years ago)
Author:
rick
Message:

Aliases moeten in shared-network groups gezet worden.

Related-To: nodefactory#156

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r10733 r10734  
    397397\n""").render(datadump)
    398398
     399  dhcp_out = defaultdict(list)
    399400  for iface_key in datadump['autogen_iface_keys']:
     401    ifname = datadump[iface_key]['autogen_ifname']
    400402    if not datadump[iface_key].has_key('comment'):
    401403      datadump[iface_key]['comment'] = None
    402     output += "## %(interface)s - %(desc)s - %(comment)s\n" % datadump[iface_key]
     404    dhcp_out[ifname].append("  ## %(interface)s - %(desc)s - %(comment)s\n" % datadump[iface_key])
    403405
    404406    (addr, mask) = datadump[iface_key]['ip'].split('/')
     
    409411      (dhcp_start, dhcp_stop) = datadump[iface_key]['dhcp'].split('-')
    410412    except (AttributeError, ValueError):
    411       output += "subnet %(subnet)s netmask %(netmask)s {\n  ### not autoritive\n}\n\n" % datadump[iface_key]
     413      dhcp_out[ifname].append("  subnet %(subnet)s netmask %(netmask)s {\n    ### not autoritive\n  }\n" % datadump[iface_key])
    412414      continue
    413415
     
    415417    datadump[iface_key]['dhcp_start'] = dhcp_part + "." + dhcp_start
    416418    datadump[iface_key]['dhcp_stop'] =  dhcp_part + "." + dhcp_stop
    417     output += """\
    418 subnet %(subnet)s netmask %(netmask)s {
    419   range %(dhcp_start)s %(dhcp_stop)s;
    420   option routers %(addr)s;
    421   option domain-name-servers %(addr)s;
    422 }
    423 \n""" % datadump[iface_key]
    424 
     419    dhcp_out[ifname].append("""\
     420   subnet %(subnet)s netmask %(netmask)s {
     421     range %(dhcp_start)s %(dhcp_stop)s;
     422     option routers %(addr)s;
     423     option domain-name-servers %(addr)s;
     424   }
     425""" % datadump[iface_key])
     426
     427  for ifname,value in dhcp_out.iteritems():
     428    output += ("shared-network %s {\n" % ifname) + ''.join(value)  + '}\n\n'
    425429  return output
    426430
Note: See TracChangeset for help on using the changeset viewer.