Changeset 8262 in genesis
- Timestamp:
- Aug 8, 2010, 12:43:27 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nodes/gformat.py
r8259 r8262 123 123 124 124 for iface_key in datadump['iface_keys']: 125 output += "## %(interface)s %(desc)s\n" % datadump[iface_key] 125 if not datadump[iface_key].has_key('comment'): 126 datadump[iface_key]['comment'] = None 127 output += "## %(interface)s - %(desc)s - %(comment)s\n" % datadump[iface_key] 126 128 127 129 try: … … 129 131 (ip, netmask) = datadump[iface_key]['ip'].split('/') 130 132 datadump[iface_key]['subnet'] = netmask2subnet(netmask) 131 except AttributeError:133 except (AttributeError, ValueError): 132 134 output += "# not autoritive\n\n" 133 135 continue … … 238 240 """ Get configuration yaml for 'item'""" 239 241 gfile = NODE_DIR + '/%s/wleiden.yaml' % item 240 gfile = 'test.yaml'241 242 242 243 f = open(gfile, 'r') … … 277 278 output = generate_header("#") 278 279 output += "# Genesis config yaml style\n" 280 output += "# vim:ts=2:et:sw=2:ai\n" 279 281 output += "#\n" 280 282 iface_keys = [elem for elem in datadump.keys() if elem.startswith('iface_')] … … 286 288 for iface_key in sorted(iface_keys): 287 289 output += "%s:\n" % iface_key 288 output += yaml.dump(datadump[iface_key], default_flow_style=False) 290 for key in sorted(datadump[iface_key]): 291 #output += yaml.dump(datadump[iface_key], default_flow_style=False) 292 output += " %s: %s\n" % (key, datadump[iface_key][key]) 289 293 output += "\n\n" 290 294
Note:
See TracChangeset
for help on using the changeset viewer.