source: genesis/nodes/gindent.py@ 8578

Last change on this file since 8578 was 8268, checked in by rick, 14 years ago

Whole bunch of tools around the YAML config files for easy editing, formatting and syntax checking

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 807 bytes
Line 
1#!/usr/bin/env python
2# vim:ts=2:et:sw=2:ai
3#
4# Build topological network graph
5# Rick van der Zwet <info@rickvanderzwet.nl>
6import gformat
7import sys
8
9__version__ = '$Id: gindent.py 8268 2010-08-08 15:24:13Z rick $'
10
11def gindent(hosts):
12 """ Pretty indent all files automatically """
13 try:
14 for host in hosts:
15 print "## Processing host %-20s: " % host,
16 datadump = gformat.get_yaml(host)
17 gformat.write_yaml(host, datadump)
18 print "OK"
19 except (KeyError, ValueError), e:
20 print "[ERROR] in '%s' interface '%s'" % (host,iface_key)
21 print e
22 sys.exit(1)
23
24
25if __name__ == "__main__":
26 if len(sys.argv) == 1:
27 print "Usage: %s <all|host [host2 host3 ...]>" % sys.argv[0]
28 sys.exit(1)
29 elif sys.argv[1] == "all":
30 gindent(gformat.get_proxylist() + gformat.get_nodelist())
31 else:
32 gindent(sys.argv[1:])
33
Note: See TracBrowser for help on using the repository browser.