From a7e91b6f4082f528a6f027ef2ee374f38fb4cc09 Mon Sep 17 00:00:00 2001 From: Thomas M Steenholdt Date: Thu, 24 May 2018 16:12:12 -0200 Subject: [PATCH] Fix SOA-EDIT-API options The options for SOA-EDIT-API included was actually the options used for SOA-EDIT, which is a very different beast. Those options have been swapped out for the options allowed in SOA-EDIT-API and SOA-EDIT-DNSUPDATE. --- app/models.py | 52 ++++++++++++++-------------- app/templates/domain_add.html | 44 ++++++----------------- app/templates/domain_management.html | 28 +++++---------- 3 files changed, 44 insertions(+), 80 deletions(-) diff --git a/app/models.py b/app/models.py index a246320..a3592c7 100644 --- a/app/models.py +++ b/app/models.py @@ -627,21 +627,19 @@ class Domain(db.Model): domain_name = domain_name + '.' domain_ns = [ns + '.' for ns in domain_ns] - if soa_edit_api == 'OFF': - post_data = { - "name": domain_name, - "kind": domain_type, - "masters": domain_master_ips, - "nameservers": domain_ns, - } - else: - post_data = { - "name": domain_name, - "kind": domain_type, - "masters": domain_master_ips, - "nameservers": domain_ns, - "soa_edit_api": soa_edit_api - } + if soa_edit_api not in ["DEFAULT", "INCREASE", "EPOCH", "OFF"]: + soa_edit_api = 'DEFAULT' + + elif soa_edit_api == 'OFF': + soa_edit_api = '' + + post_data = { + "name": domain_name, + "kind": domain_type, + "masters": domain_master_ips, + "nameservers": domain_ns, + "soa_edit_api": soa_edit_api + } try: jdata = utils.fetch_json(urljoin(PDNS_STATS_URL, API_EXTENDED_URL + '/servers/localhost/zones'), headers=headers, method='POST', data=post_data) @@ -662,16 +660,18 @@ class Domain(db.Model): return {'status': 'error', 'msg': 'Domain doesnt exist.'} headers = {} headers['X-API-Key'] = PDNS_API_KEY - if soa_edit_api == 'OFF': - post_data = { - "soa_edit_api": None, - "kind": domain.type - } - else: - post_data = { - "soa_edit_api": soa_edit_api, - "kind": domain.type - } + + if soa_edit_api not in ["DEFAULT", "INCREASE", "EPOCH", "OFF"]: + soa_edit_api = 'DEFAULT' + + elif soa_edit_api == 'OFF': + soa_edit_api = '' + + post_data = { + "soa_edit_api": soa_edit_api, + "kind": domain.type + } + try: jdata = utils.fetch_json( urljoin(PDNS_STATS_URL, API_EXTENDED_URL + '/servers/localhost/zones/{0}'.format(domain.name)), headers=headers, @@ -705,7 +705,7 @@ class Domain(db.Model): system_auto_ptr or \ domain_auto_ptr ): - result = self.add(domain_reverse_name, 'Master', 'INCEPTION-INCREMENT', '', '') + result = self.add(domain_reverse_name, 'Master', 'DEFAULT', '', '') self.update() if result['status'] == 'ok': history = History(msg='Add reverse lookup domain {0}'.format(domain_reverse_name), detail=str({'domain_type': 'Master', 'domain_master_ips': ''}), created_by='System') diff --git a/app/templates/domain_add.html b/app/templates/domain_add.html index 96daec5..d64beb1 100644 --- a/app/templates/domain_add.html +++ b/app/templates/domain_add.html @@ -63,27 +63,12 @@
-
-
- -
-
- -
-
-
@@ -93,7 +78,7 @@
@@ -132,28 +117,19 @@
SOA-EDIT-API
-
The SOA-EDIT-API setting defines when and how the SOA serial number will be updated after a change is made to the domain. +
The SOA-EDIT-API setting defines how the SOA serial number will be updated after a change is made to the domain.
@@ -176,4 +152,4 @@ } }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/templates/domain_management.html b/app/templates/domain_management.html index 8ca8507..bf35849 100644 --- a/app/templates/domain_management.html +++ b/app/templates/domain_management.html @@ -109,41 +109,29 @@

Change SOA-EDIT-API

-

The SOA-EDIT-API setting defines when and how the SOA serial number will be updated after a change is made to the domain.

+

The SOA-EDIT-API setting defines how the SOA serial number will be updated after a change is made to the domain.

New SOA-EDIT-API Setting: