Changeset 10882 in genesis


Ignore:
Timestamp:
May 16, 2012, 7:47:50 PM (13 years ago)
Author:
rick
Message:

Whoops, geef aan dat een heel stapel keys toch echt automatisch generered worden.

Relelated-To: beheer:ticket:218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r10881 r10882  
    429429
    430430    (addr, mask) = datadump[iface_key]['ip'].split('/')
    431     datadump[iface_key]['addr'] = addr
    432     datadump[iface_key]['netmask'] = cidr2netmask(mask)
    433     datadump[iface_key]['subnet'] = get_network(addr, mask)
     431    datadump[iface_key]['autogen_addr'] = addr
     432    datadump[iface_key]['autogen_netmask'] = cidr2netmask(mask)
     433    datadump[iface_key]['autogen_subnet'] = get_network(addr, mask)
    434434    try:
    435435      (dhcp_start, dhcp_stop) = datadump[iface_key]['dhcp'].split('-')
    436436    except (AttributeError, ValueError, KeyError):
    437       dhcp_out[ifname].append("  subnet %(subnet)s netmask %(netmask)s {\n    ### not autoritive\n  }\n" % datadump[iface_key])
     437      dhcp_out[ifname].append("  subnet %(autogen_subnet)s netmask %(autogen_netmask)s {\n    ### not autoritive\n  }\n" % datadump[iface_key])
    438438      continue
    439439
    440440    dhcp_part = ".".join(addr.split('.')[0:3])
    441     datadump[iface_key]['dhcp_start'] = dhcp_part + "." + dhcp_start
    442     datadump[iface_key]['dhcp_stop'] =  dhcp_part + "." + dhcp_stop
     441    datadump[iface_key]['autogen_dhcp_start'] = dhcp_part + "." + dhcp_start
     442    datadump[iface_key]['autogen_dhcp_stop'] =  dhcp_part + "." + dhcp_stop
    443443    dhcp_out[ifname].append("""\
    444    subnet %(subnet)s netmask %(netmask)s {
    445      range %(dhcp_start)s %(dhcp_stop)s;
    446      option routers %(addr)s;
    447      option domain-name-servers %(addr)s;
     444   subnet %(autogen_subnet)s netmask %(autogen_netmask)s {
     445     range %(autogen_dhcp_start)s %(autogen_dhcp_stop)s;
     446     option routers %(autogen_addr)s;
     447     option domain-name-servers %(autogen_addr)s;
    448448   }
    449449""" % datadump[iface_key])
     
    480480      (dhcp_start, dhcp_stop) = datadump[iface_key]['dhcp'].split('-')
    481481      (ip, cidr) = datadump[iface_key]['ip'].split('/')
    482       datadump[iface_key]['netmask'] = cidr2netmask(cidr)
     482      datadump[iface_key]['autogen_netmask'] = cidr2netmask(cidr)
    483483    except (AttributeError, ValueError, KeyError):
    484484      output += "# not autoritive\n\n"
     
    486486
    487487    dhcp_part = ".".join(ip.split('.')[0:3])
    488     datadump[iface_key]['dhcp_start'] = dhcp_part + "." + dhcp_start
    489     datadump[iface_key]['dhcp_stop'] =  dhcp_part + "." + dhcp_stop
    490     output += "dhcp-range=%(interface)s,%(dhcp_start)s,%(dhcp_stop)s,%(netmask)s,24h\n\n" % datadump[iface_key]
     488    datadump[iface_key]['autogen_dhcp_start'] = dhcp_part + "." + dhcp_start
     489    datadump[iface_key]['autogen_dhcp_stop'] =  dhcp_part + "." + dhcp_stop
     490    output += "dhcp-range=%(interface)s,%(autogen_dhcp_start)s,%(autogen_dhcp_stop)s,%(autogen_netmask)s,24h\n\n" % datadump[iface_key]
    491491
    492492  return output
     
    695695    if ifacedump['type'] in ['11a', '11b', '11g', 'wireless']:
    696696      # Default to station (client) mode
    697       ifacedump['wlanmode'] = "sta"
     697      ifacedump['autogen_wlanmode'] = "sta"
    698698      if ifacedump['mode'] in ['master', 'master-wds', 'ap', 'ap-wds']:
    699         ifacedump['wlanmode'] = "ap"
     699        ifacedump['autogen_wlanmode'] = "ap"
    700700      # Default to 802.11b mode
    701701      ifacedump['mode'] = '11b'
     
    711711      # Allow special hacks at the back like wds and stuff
    712712      if not ifacedump.has_key('extra'):
    713         ifacedump['extra'] = 'regdomain ETSI country NL'
     713        ifacedump['autogen_extra'] = 'regdomain ETSI country NL'
     714      else:
     715        ifacedump['autogen_extra'] = ifacedump['extra']
     716       
    714717
    715718      output += "wlans_%(interface)s='%(autogen_ifname)s'\n" % ifacedump
    716       output += ("create_args_%(autogen_ifname)s='wlanmode %(wlanmode)s mode " +\
    717         "%(mode)s ssid %(ssid)s %(extra)s channel %(channel)s'\n") % ifacedump
     719      output += ("create_args_%(autogen_ifname)s='wlanmode %(autogen_wlanmode)s mode " +\
     720        "%(mode)s ssid %(ssid)s %(autogen_extra)s channel %(channel)s'\n") % ifacedump
    718721
    719722    elif ifacedump['type'] in ['ethernet', 'eth']:
     
    11311134      try:
    11321135        (dhcp_start, dhcp_stop) = datadump[iface_key]['dhcp'].split('-')
    1133         datadump[iface_key]['netmask'] = cidr2netmask(cidr)
     1136        datadump[iface_key]['autogen_netmask'] = cidr2netmask(cidr)
    11341137        dhcp_part = ".".join(ip.split('.')[0:3])
    11351138        if ip != datadump['masterip']:
     
    15021505            if not datadump[iface_key].has_key('comment'):
    15031506              datadump[iface_key]['comment'] = 'autogen-FIXME'
     1507
     1508            if datadump[iface_key]['comment'].startswith('autogen-') and datadump[iface_key].has_key('comment'):
     1509              datadump[iface_key]['comment'] = datadump[iface_key]['desc']
     1510
     1511            if datadump[iface_key].has_key('desc') and datadump[iface_key]['comment'] == datadump[iface_key]['desc']:
     1512              del datadump[iface_key]['desc']
     1513
    15041514            # Set the compass value based on the angle between the poels
    15051515            if datadump[iface_key].has_key('ns_ip'):
Note: See TracChangeset for help on using the changeset viewer.