Changeset 13937 in genesis
- Timestamp:
- Jul 6, 2017, 9:10:48 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r13936 r13937 1469 1469 1470 1470 1471 def generate_static(output_dir, logging=True): 1472 items = {'output_dir' : output_dir} 1473 for node in get_hostlist(): 1474 items['node'] = node 1475 items['wdir'] = "%(output_dir)s/%(node)s" % items 1476 if not os.path.isdir(items['wdir']): 1477 os.makedirs(items['wdir']) 1478 datadump = get_yaml(node) 1479 f = open("%(wdir)s/index.html" % items, "w") 1480 f.write(generate_node_overview(items['node'], datadump)) 1481 f.close() 1482 for config in files: 1483 items['config'] = config 1484 if logging: logger.info("## Generating %(node)s %(config)s" % items) 1485 f = open("%(wdir)s/%(config)s" % items, "w") 1486 f.write(generate_config(node, config, datadump)) 1487 f.close() 1488 1489 1490 1471 1491 def process_cgi_request(environ=os.environ): 1472 1492 """ When calling from CGI """ … … 1480 1500 output += subprocess.Popen([SVN, 'cleanup', "%s/.." % NODE_DIR], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0] 1481 1501 output += subprocess.Popen([SVN, 'up', "%s/.." % NODE_DIR], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0] 1502 generate_static(CACHE_DIR, False) 1482 1503 output += "[INFO] All done, redirecting in 5 seconds" 1483 1504 response_headers += [ … … 1875 1896 print_cgi_response(response_headers, output) 1876 1897 elif sys.argv[1] == "static": 1877 items = dict() 1878 items['output_dir'] = sys.argv[2] if len(sys.argv) > 2 else "./static" 1879 for node in get_hostlist(): 1880 items['node'] = node 1881 items['wdir'] = "%(output_dir)s/%(node)s" % items 1882 if not os.path.isdir(items['wdir']): 1883 os.makedirs(items['wdir']) 1884 datadump = get_yaml(node) 1885 f = open("%(wdir)s/index.html" % items, "w") 1886 f.write(generate_node_overview(items['node'], datadump)) 1887 f.close() 1888 for config in files: 1889 items['config'] = config 1890 logger.info("## Generating %(node)s %(config)s" % items) 1891 f = open("%(wdir)s/%(config)s" % items, "w") 1892 f.write(generate_config(node, config, datadump)) 1893 f.close() 1898 generate_static(sys.argv[2] if len(sys.argv) > 2 else "./static") 1894 1899 elif sys.argv[1] == "wind-export": 1895 1900 items = dict()
Note:
See TracChangeset
for help on using the changeset viewer.