Changeset 10264 in genesis


Ignore:
Timestamp:
Mar 21, 2012, 8:36:02 PM (13 years ago)
Author:
rick
Message:

Support generating an external zone file using an awefull hack.

Related-To: beheer#136

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r10244 r10264  
    686686
    687687
    688 def make_dns(output_dir = 'dns'):
     688def make_dns(output_dir = 'dns', external = False):
    689689  items = dict()
    690690
     
    809809  details['serial'] = time.strftime('%Y%m%d%H')
    810810
     811  if external:
     812    dns_masters = ['siteview.wirelessleiden.nl', 'ns1.vanderzwet.net']
     813  else:
     814    dns_masters = ['sunny.wleiden.net']
     815
     816  details['master'] = dns_masters[0]
     817  details['ns_servers'] = '\n'.join(['\tNS\t%s.' % x for x in dns_masters])
     818
    811819  dns_header = '''
    812820$TTL 3h
    813 %(zone)s. SOA sunny.wleiden.net. beheer.lijst.wirelessleiden.nl. ( %(serial)s 1d 12h 1w 3h )
     821%(zone)s. SOA %(master)s. beheer.lijst.wirelessleiden.nl. ( %(serial)s 1d 12h 1w 3h )
    814822        ; Serial, Refresh, Retry, Expire, Neg. cache TTL
    815823
    816         NS      sunny.wleiden.net.
     824%(ns_servers)s
    817825  \n'''
    818826
    819827
    820   if not os.path.isdir('dns'):
    821     os.makedirs('dns')
     828  if not os.path.isdir(output_dir):
     829    os.makedirs(output_dir)
    822830  details['zone'] = 'wleiden.net'
    823831  f = open(os.path.join(output_dir,"db." + details['zone']), "w")
     
    976984
    977985    elif sys.argv[1] == "dns":
    978       make_dns(sys.argv[2] if len(sys.argv) > 2 else 'dns')
     986      make_dns(sys.argv[2] if len(sys.argv) > 2 else 'dns', 'external' in sys.argv)
    979987    elif sys.argv[1] == "cleanup":
    980988      # First generate all datadumps
Note: See TracChangeset for help on using the changeset viewer.