Changeset 10563 in genesis for tools/gformat.py


Ignore:
Timestamp:
Apr 23, 2012, 7:38:29 PM (13 years ago)
Author:
rick
Message:

Visible warning about how-to make proper changes with this code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r10547 r10563  
    10521052\twind-export                  =  Generate SQL import scripts for WIND database
    10531053\tfull-export                  =  Generate yaml export script for heatmap.
    1054 \tstatic                       =  Generate all config files and store on disk
     1054\tstatic [./static]            =  Generate all config files and store on disk
    10551055\t                                with format ./static/%%NODE%%/%%FILE%%
    10561056\ttest CNodeRick dnsmasq.conf  =  Receive output of CGI script
    10571057\t                                for arguments CNodeRick/dnsmasq.conf
    10581058\tlist <all|nodes|proxies>     =  List systems which marked up.
     1059
     1060NOTE 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
    10591067"""
    10601068  exit(0)
     
    11161124      os.environ['SCRIPT_NAME'] = __file__
    11171125      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             raise
    1128            
    1129            
    11301126    elif sys.argv[1] == "static":
    11311127      items = dict()
     1128      items['output_dir'] = sys.argv[2] if len(sys.argv) > 2 else "./static"
    11321129      for node in get_hostlist():
    11331130        items['node'] = node
    1134         items['wdir'] = "./static/%(node)s" % items
     1131        items['wdir'] = "%(output_dir)s/%(node)s" % items
    11351132        if not os.path.isdir(items['wdir']):
    11361133          os.makedirs(items['wdir'])
Note: See TracChangeset for help on using the changeset viewer.