Changeset 8272 in genesis for nodes


Ignore:
Timestamp:
Aug 8, 2010, 7:52:52 PM (14 years ago)
Author:
rick
Message:
  • Field dependant ordering
File:
1 edited

Legend:

Unmodified
Added
Removed
  • nodes/gformat.py

    r8267 r8272  
    322322  output += "\n\n"
    323323 
     324  key_order = [ 'comment', 'interface', 'ip', 'desc', 'sdesc', 'mode', 'type',
     325    'extra_type', 'channel', 'ssid', 'dhcp' ]
     326
    324327  for iface_key in sorted(iface_keys):
    325328    output += "%s:\n" % iface_key
    326     for key in sorted(datadump[iface_key]):
    327       output += "  %-11s: %s\n" % (key, format_yaml_value(datadump[iface_key][key]))
     329    for key in key_order + list(sorted(set(datadump[iface_key].keys()) - set(key_order))):
     330      if datadump[iface_key].has_key(key):
     331        output += "  %-11s: %s\n" % (key, format_yaml_value(datadump[iface_key][key]))
    328332    output += "\n\n"
    329333
Note: See TracChangeset for help on using the changeset viewer.