Add ability to create CNAME records with data_suffix on add record function
Tested: adding/deleting cnames and A records.
This commit is contained in:
parent
a03f49c158
commit
21b28be873
|
@ -2,7 +2,7 @@ from django import forms
|
||||||
|
|
||||||
from bcommon.models import BindServer, Key
|
from bcommon.models import BindServer, Key
|
||||||
|
|
||||||
RECORD_TYPE_CHOICES = (("A", "A"), ("AAAA", "AAAA"))
|
RECORD_TYPE_CHOICES = (("A", "A"), ("AAAA", "AAAA"), ("CNAME", "CNAME"))
|
||||||
TTL_CHOICES = ((300, "5 minutes"),
|
TTL_CHOICES = ((300, "5 minutes"),
|
||||||
(1800, "30 minutes"),
|
(1800, "30 minutes"),
|
||||||
(3600, "1 hour"),
|
(3600, "1 hour"),
|
||||||
|
|
|
@ -43,7 +43,12 @@ def add_forward_record(form_data, zone_keyring):
|
||||||
domain = re_form_data.group(2)
|
domain = re_form_data.group(2)
|
||||||
|
|
||||||
dns_update = dns.update.Update(domain, keyring = zone_keyring)
|
dns_update = dns.update.Update(domain, keyring = zone_keyring)
|
||||||
dns_update.replace(hostname, int(form_data["ttl"]), str(form_data["record_type"]), str(form_data["data"]))
|
if str(form_data["record_type"]) == "CNAME":
|
||||||
|
data_suffix = "."
|
||||||
|
else:
|
||||||
|
data_suffix = ""
|
||||||
|
|
||||||
|
dns_update.replace(hostname, int(form_data["ttl"]), str(form_data["record_type"]), str(form_data["data"]) + data_suffix)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = dns.query.tcp(dns_update, form_data["dns_server"])
|
response = dns.query.tcp(dns_update, form_data["dns_server"])
|
||||||
|
|
Loading…
Reference in New Issue