def migrate_zone(root_domain_name, name_reversed, zone_path, ztype, view, relative_path): if view == "both": private, _ = View.objects.get_or_create(name="private") public, _ = View.objects.get_or_create(name="public") views = [private, public] else: view_obj, _ = View.objects.get_or_create(name=view) views = [view_obj] try: if ztype == 'r': if name_reversed: root_domain_name = '.'.join(reversed(root_domain_name.split('.')) ) + ".in-addr.arpa" else: root_domain_name = '.'.join( root_domain_name.split('.')) + ".in-addr.arpa" svn_zone = collect_svn_zone( root_domain_name, zone_path, settingsZONE_PATH) except dns.zone.NoSOA, e: print "----------------------" print "ERROR: NoSOA()" print zone_path print "----------------------" return
def do_zone_build(ztype, view, root_domain, zone_path): view_obj, _ = View.objects.get_or_create(name=view) if ztype == 'forward': svn_zones = {root_domain.replace( 'mozilla.com', ''): ((collect_svn_zone(root_domain, zone_path, settingsZONE_PATH)), '')} populate_forward_dns(svn_zones, view=view_obj) elif ztype == 'reverse': rev_svn_zones = {root_domain: ( '', ((collect_rev_svn_zone(root_domain, zone_path, settingsZONE_PATH)), ''))} populate_reverse_dns(rev_svn_zones, view=view_obj) else: print "Slob"
def zone_build_from_config(job=None): """ This is so f****d. We can't run all of these at once because it causes the box to run out of memory. """ if not job: print "Jobs are: external, dc, private_reverse" return import dns if job == "external": from cyder.dnsutils.migrate.zone_configs.external import external for config in external: zone_path = config['path'] root_domain = config['zone_name'] name_reversed = config['name_reversed'] ztype = config['direction'] view = config['view'] relative_path = config['relative_path'] if view == "both": private, _ = View.objects.get_or_create(name="private") public, _ = View.objects.get_or_create(name="public") views = [private, public] else: view_obj, _ = View.objects.get_or_create(name=view) views = [view_obj] try: if ztype == 'f': print view svn_zone = collect_svn_zone(root_domain, zone_path, settingsZONE_PATH) populate_forward_dns(svn_zone, root_domain, views=views) del svn_zone if ztype == 'r': rev_svn_zones = { root_domain: ('', ((collect_rev_svn_zone(root_domain, zone_path, settingsZONE_PATH)), '')) } populate_reverse_dns(rev_svn_zones, views=views) except dns.zone.NoSOA, e: print "----------------------" print "ERROR: NoSOA()" print zone_path print "----------------------" return
def do_zone_build(ztype, view, root_domain, zone_path): view_obj, _ = View.objects.get_or_create(name=view) if ztype == 'forward': svn_zones = { root_domain.replace('mozilla.com', ''): ((collect_svn_zone(root_domain, zone_path, settingsZONE_PATH)), '') } populate_forward_dns(svn_zones, view=view_obj) elif ztype == 'reverse': rev_svn_zones = { root_domain: ('', ((collect_rev_svn_zone(root_domain, zone_path, settingsZONE_PATH)), '')) } populate_reverse_dns(rev_svn_zones, view=view_obj) else: print "Slob"
def zone_build_from_config(job=None): """ This is so f****d. We can't run all of these at once because it causes the box to run out of memory. """ if not job: print "Jobs are: external, dc, private_reverse" return import dns if job == "external": from cyder.dnsutils.migrate.zone_configs.external import external for config in external: zone_path = config['path'] root_domain = config['zone_name'] name_reversed = config['name_reversed'] ztype = config['direction'] view = config['view'] relative_path = config['relative_path'] if view == "both": private, _ = View.objects.get_or_create(name="private") public, _ = View.objects.get_or_create(name="public") views = [private, public] else: view_obj, _ = View.objects.get_or_create(name=view) views = [view_obj] try: if ztype == 'f': print view svn_zone = collect_svn_zone( root_domain, zone_path, settingsZONE_PATH) populate_forward_dns(svn_zone, root_domain, views=views) del svn_zone if ztype == 'r': rev_svn_zones = {root_domain: ( '', ((collect_rev_svn_zone(root_domain, zone_path, settingsZONE_PATH)), ''))} populate_reverse_dns(rev_svn_zones, views=views) except dns.zone.NoSOA, e: print "----------------------" print "ERROR: NoSOA()" print zone_path print "----------------------" return
for config in zones: zone_path = config['path'] root_domain = config['zone_name'] name_reversed = config['name_reversed'] ztype = config['direction'] view = config['view'] relative_path = config['relative_path'] if view == "both": private, _ = View.objects.get_or_create(name="private") public, _ = View.objects.get_or_create(name="public") views = [private, public] else: view_obj, _ = View.objects.get_or_create(name=view) views = [view_obj] if ztype == 'f': svn_zone = collect_svn_zone( root_domain, zone_path, settingsZONE_PATH) populate_forward_dns(svn_zone, root_domain, views=views) del svn_zone return if job == "net": from cyder.dnsutils.migrate.zone_configs.mozilla_net import mozilla_net for config in mozilla_net: zone_path = config['path'] root_domain = config['zone_name'] name_reversed = config['name_reversed'] ztype = config['direction'] view = config['view'] relative_path = config['relative_path'] if view == "both": private, _ = View.objects.get_or_create(name="private")
for config in zones: zone_path = config['path'] root_domain = config['zone_name'] name_reversed = config['name_reversed'] ztype = config['direction'] view = config['view'] relative_path = config['relative_path'] if view == "both": private, _ = View.objects.get_or_create(name="private") public, _ = View.objects.get_or_create(name="public") views = [private, public] else: view_obj, _ = View.objects.get_or_create(name=view) views = [view_obj] if ztype == 'f': svn_zone = collect_svn_zone(root_domain, zone_path, settingsZONE_PATH) populate_forward_dns(svn_zone, root_domain, views=views) del svn_zone return if job == "net": from cyder.dnsutils.migrate.zone_configs.mozilla_net import mozilla_net for config in mozilla_net: zone_path = config['path'] root_domain = config['zone_name'] name_reversed = config['name_reversed'] ztype = config['direction'] view = config['view'] relative_path = config['relative_path'] if view == "both": private, _ = View.objects.get_or_create(name="private")