Changeset 8622 in genesis for tools


Ignore:
Timestamp:
Oct 31, 2010, 9:24:42 PM (14 years ago)
Author:
rick
Message:
  • Haasje over tussen verschillende functies in files om ze op de juiste locatie te zetten.
  • staticDNS.yaml is makkelijker te parsen en better te lezen
Location:
tools
Files:
1 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r8615 r8622  
    44# Wireless Leiden configuration generator, based on yaml files'
    55# Rick van der Zwet <info@rickvanderzwet.nl>
     6
     7# Hack to make the script directory is also threated as a module search path.
     8import sys
     9import os
     10sys.path.append(os.path.dirname(__file__))
     11
    612import cgi
    713import cgitb
    814import copy
    915import glob
    10 import os
    1116import socket
    1217import string
    1318import subprocess
    14 import sys
    1519import time
    16 import make_map
     20import rdnap
    1721from pprint import pprint
    1822try:
     
    3135 
    3236
    33 NODE_DIR = os.path.dirname(os.path.realpath(__file__))
     37NODE_DIR = os.getcwd()
    3438__version__ = '$Id$'
    3539
     
    608612  ## roomburgh=CNodeRoomburgh1
    609613  ## apkerk1.CNodeVosko=172.17.176.8 ;this as well
    610   f = open('../dns/staticDNS.conf','r')
    611   for l in f.readlines():
    612     # Get rid of comments
    613     l = l.strip().split(';')[0].strip()
    614     if l:
    615       k,v = l.split('=')
     614  dns = yaml.load(open('../dns/staticDNS.yaml','r'))
     615  for comment, block in dns.iteritems():
     616    for k,v in block.iteritems():
    616617      if valid_addr(v):
    617618        wleiden_zone[k] = v
    618619      else:
    619620        wleiden_cname[k] = v
    620   f.close()
    621621     
    622622  details = dict()
     
    734734        datadumps[get_fqdn(datadump)] = datadump
    735735     
    736         datadump['latitude'], datadump['longitude'] = make_map.rd2etrs(datadump['rdnap_x'], datadump['rdnap_y'])
     736        datadump['latitude'], datadump['longitude'] = rdnap.rd2etrs(datadump['rdnap_x'], datadump['rdnap_y'])
    737737        write_yaml(host, datadump)
    738738    else:                             
Note: See TracChangeset for help on using the changeset viewer.