Changeset 9284 in genesis for tools


Ignore:
Timestamp:
Jun 23, 2011, 6:58:36 PM (14 years ago)
Author:
rick
Message:

Make sure all path references runs fine and allow DNS output path to be custom
to make sure it does not clutter the repository.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r9283 r9284  
    351351def get_yaml(item):
    352352  """ Get configuration yaml for 'item'"""
    353   gfile = NODE_DIR + '/%s/wleiden.yaml' % item
     353  gfile = os.path.join(NODE_DIR,item,'wleiden.yaml')
    354354
    355355  f = open(gfile, 'r')
     
    361361def store_yaml(datadump):
    362362  """ Store configuration yaml for 'item'"""
    363   gfile = NODE_DIR + '/%s/wleiden.yaml' % item
     363  gfile = os.path.join(NODE_DIR,item,'wleiden.yaml')
    364364
    365365  f = open(gfile, 'w')
     
    402402def write_yaml(item, datadump):
    403403  """ Write configuration yaml for 'item'"""
    404   gfile = NODE_DIR + '/%s/wleiden.yaml' % item
     404  gfile = os.path.join(NODE_DIR,item,'wleiden.yaml')
    405405
    406406  f = open(gfile, 'w')
     
    550550
    551551
    552 def make_dns():
     552def make_dns(output_dir = 'dns'):
    553553  items = dict()
    554554
     
    615615  ## roomburgh=CNodeRoomburgh1
    616616  ## apkerk1.CNodeVosko=172.17.176.8 ;this as well
    617   dns = yaml.load(open('../dns/staticDNS.yaml','r'))
     617  dns = yaml.load(open(os.path.join(NODE_DIR,'../dns/staticDNS.yaml'),'r'))
    618618  for comment, block in dns.iteritems():
    619619    for k,v in block.iteritems():
     
    639639    os.makedirs('dns')
    640640  details['zone'] = 'wleiden.net'
    641   f = open("dns/db." + details['zone'], "w")
     641  f = open(os.path.join(output_dir,"db." + details['zone']), "w")
    642642  f.write(dns_header % details)
    643643
     
    652652  for s in range(16,32):
    653653    details['zone'] = '%i.172.in-addr.arpa' % s
    654     f = open("dns/db." + details['zone'], "w")
     654    f = open(os.path.join(output_dir,"db." + details['zone']), "w")
    655655    f.write(dns_header % details)
    656656
     
    668668  print """Usage: %s <standalone [port] |test [test arguments]|static|dns>
    669669Examples:
    670 \tdns                          =  Generate BIND compliant zone files in dns.
     670\tdns [outputdir]              =  Generate BIND compliant zone files in dns.
    671671\tstandalone                   =  Run configurator webserver [default port=8000]
    672672\tstatic                       =  Generate all config files and store on disk
     
    734734          f.close()
    735735    elif sys.argv[1] == "dns":
    736       make_dns()
     736      make_dns(sys.argv[2] if sys.argv[2] else 'dns')
    737737    elif sys.argv[1] == "cleanup":
    738738      # First generate all datadumps
Note: See TracChangeset for help on using the changeset viewer.