Exemple #1
0
 def gen_zone(self, domain):
     domain.new_serial()
     records = []
     for ns in [get_primary_ns_server().domain
                ] + [x.domain for x in get_secondary_ns_servers()]:
         records.append({
             "name": "@",
             "TTL": domain.ttl if domain.ttl else 86400,
             "type": "NS",
             "prio": "",
             "value": "%s." % ns
         })
     for record in domain.record_set.order_by("order_num"):
         records.append({
             "name": record.name,
             "TTL": record.ttl if record.ttl else 86400,
             "type": record.record_type,
             "prio": record.prio if record.prio else "",
             "value": record.value,
         })
     return render_to_string(
         "dns/zone.txt", {
             "records": records,
             "TTL": domain.ttl if domain.ttl else 86400,
             "ns1": get_primary_ns_server().domain,
             "rname": domain.rname.replace("@", "."),
             "serial": domain.serial,
             "refresh": config.dns_refresh,
             "retry": config.dns_retry,
             "expire": config.dns_expire,
             "minimum": config.dns_minimum,
         })
Exemple #2
0
 def gen_master_config(self):
     domains = []
     for domain in Domain.objects.all():
         domains.append(render_to_string("dns/master_config.txt", {
             "domain": domain.name,
             "slaves_ips": ";".join([x.ip for x in get_secondary_ns_servers()]),
         }))
     return "\n".join(domains)
Exemple #3
0
 def gen_master_config(self):
     domains = []
     for domain in Domain.objects.all():
         domains.append(
             render_to_string(
                 "dns/master_config.txt", {
                     "domain":
                     domain.name,
                     "slaves_ips":
                     ";".join([x.ip for x in get_secondary_ns_servers()]),
                 }))
     return "\n".join(domains)
Exemple #4
0
 def gen_zone(self, domain):
     domain.new_serial()
     records = []
     for ns in [get_primary_ns_server().domain] + [x.domain for x in get_secondary_ns_servers()]:
         records.append({"name": "@", "TTL": domain.ttl if domain.ttl else 86400, "type": "NS", "prio": "", "value": "%s." % ns})
     for record in domain.record_set.order_by("order_num"):
         records.append({
             "name": record.name,
             "TTL": record.ttl if record.ttl else 86400,
             "type": record.record_type,
             "prio": record.prio if record.prio else "",
             "value": record.value,
         })
     return render_to_string("dns/zone.txt", {
         "records": records,
         "TTL": domain.ttl if domain.ttl else 86400,
         "ns1": get_primary_ns_server().domain,
         "rname": domain.rname.replace("@", "."),
         "serial": domain.serial,
         "refresh": config.dns_refresh,
         "retry": config.dns_retry,
         "expire": config.dns_expire,
         "minimum": config.dns_minimum,
     })
Exemple #5
0
 def __init__(self, *args, **kwargs):
     super(DomainObject, self).__init__(*args, **kwargs)
     self.script_master = Script(get_primary_ns_server())
     self.scripts_slaves = []
     for ns in get_secondary_ns_servers():
         self.scripts_slaves.append(Script(ns))
Exemple #6
0
 def __init__(self, *args, **kwargs):
     super(DomainObject, self).__init__(*args, **kwargs)
     self.script_master = Script(get_primary_ns_server())
     self.scripts_slaves = []
     for ns in get_secondary_ns_servers():
         self.scripts_slaves.append(Script(ns))