Changeset 10734 in genesis
- Timestamp:
- May 8, 2012, 11:11:48 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r10733 r10734 397 397 \n""").render(datadump) 398 398 399 dhcp_out = defaultdict(list) 399 400 for iface_key in datadump['autogen_iface_keys']: 401 ifname = datadump[iface_key]['autogen_ifname'] 400 402 if not datadump[iface_key].has_key('comment'): 401 403 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]) 403 405 404 406 (addr, mask) = datadump[iface_key]['ip'].split('/') … … 409 411 (dhcp_start, dhcp_stop) = datadump[iface_key]['dhcp'].split('-') 410 412 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]) 412 414 continue 413 415 … … 415 417 datadump[iface_key]['dhcp_start'] = dhcp_part + "." + dhcp_start 416 418 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' 425 429 return output 426 430
Note:
See TracChangeset
for help on using the changeset viewer.