Changeset 10563 in genesis for tools/gformat.py
- Timestamp:
- Apr 23, 2012, 7:38:29 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r10547 r10563 1052 1052 \twind-export = Generate SQL import scripts for WIND database 1053 1053 \tfull-export = Generate yaml export script for heatmap. 1054 \tstatic 1054 \tstatic [./static] = Generate all config files and store on disk 1055 1055 \t with format ./static/%%NODE%%/%%FILE%% 1056 1056 \ttest CNodeRick dnsmasq.conf = Receive output of CGI script 1057 1057 \t for arguments CNodeRick/dnsmasq.conf 1058 1058 \tlist <all|nodes|proxies> = List systems which marked up. 1059 1060 NOTE FOR DEVELOPERS; you can test your changes like this: 1061 BEFORE any changes in this code: 1062 $ ./gformat.py static /tmp/pre 1063 AFTER the changes: 1064 $ ./gformat.py static /tmp/post 1065 VIEW differences and VERIFY all are OK: 1066 $ diff -uI 'Generated' -r /tmp/pre /tmp/post 1059 1067 """ 1060 1068 exit(0) … … 1116 1124 os.environ['SCRIPT_NAME'] = __file__ 1117 1125 process_cgi_request() 1118 elif sys.argv[1] == "unit-test":1119 os.environ['SCRIPT_NAME'] = __file__1120 for host in get_hostlist():1121 for outfile in files:1122 os.environ['PATH_INFO'] = "/".join([host,outfile])1123 try:1124 process_cgi_request()1125 except Exception:1126 print "# ERROR: %s" % os.environ['PATH_INFO']1127 raise1128 1129 1130 1126 elif sys.argv[1] == "static": 1131 1127 items = dict() 1128 items['output_dir'] = sys.argv[2] if len(sys.argv) > 2 else "./static" 1132 1129 for node in get_hostlist(): 1133 1130 items['node'] = node 1134 items['wdir'] = " ./static/%(node)s" % items1131 items['wdir'] = "%(output_dir)s/%(node)s" % items 1135 1132 if not os.path.isdir(items['wdir']): 1136 1133 os.makedirs(items['wdir'])
Note:
See TracChangeset
for help on using the changeset viewer.