mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-14 01:20:27 +00:00
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.
This commit is contained in:
parent
4daf6f72a7
commit
a7e91b6f40
@ -627,21 +627,19 @@ class Domain(db.Model):
|
|||||||
domain_name = domain_name + '.'
|
domain_name = domain_name + '.'
|
||||||
domain_ns = [ns + '.' for ns in domain_ns]
|
domain_ns = [ns + '.' for ns in domain_ns]
|
||||||
|
|
||||||
if soa_edit_api == 'OFF':
|
if soa_edit_api not in ["DEFAULT", "INCREASE", "EPOCH", "OFF"]:
|
||||||
post_data = {
|
soa_edit_api = 'DEFAULT'
|
||||||
"name": domain_name,
|
|
||||||
"kind": domain_type,
|
elif soa_edit_api == 'OFF':
|
||||||
"masters": domain_master_ips,
|
soa_edit_api = ''
|
||||||
"nameservers": domain_ns,
|
|
||||||
}
|
post_data = {
|
||||||
else:
|
"name": domain_name,
|
||||||
post_data = {
|
"kind": domain_type,
|
||||||
"name": domain_name,
|
"masters": domain_master_ips,
|
||||||
"kind": domain_type,
|
"nameservers": domain_ns,
|
||||||
"masters": domain_master_ips,
|
"soa_edit_api": soa_edit_api
|
||||||
"nameservers": domain_ns,
|
}
|
||||||
"soa_edit_api": soa_edit_api
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
jdata = utils.fetch_json(urljoin(PDNS_STATS_URL, API_EXTENDED_URL + '/servers/localhost/zones'), headers=headers, method='POST', data=post_data)
|
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.'}
|
return {'status': 'error', 'msg': 'Domain doesnt exist.'}
|
||||||
headers = {}
|
headers = {}
|
||||||
headers['X-API-Key'] = PDNS_API_KEY
|
headers['X-API-Key'] = PDNS_API_KEY
|
||||||
if soa_edit_api == 'OFF':
|
|
||||||
post_data = {
|
if soa_edit_api not in ["DEFAULT", "INCREASE", "EPOCH", "OFF"]:
|
||||||
"soa_edit_api": None,
|
soa_edit_api = 'DEFAULT'
|
||||||
"kind": domain.type
|
|
||||||
}
|
elif soa_edit_api == 'OFF':
|
||||||
else:
|
soa_edit_api = ''
|
||||||
post_data = {
|
|
||||||
"soa_edit_api": soa_edit_api,
|
post_data = {
|
||||||
"kind": domain.type
|
"soa_edit_api": soa_edit_api,
|
||||||
}
|
"kind": domain.type
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
jdata = utils.fetch_json(
|
jdata = utils.fetch_json(
|
||||||
urljoin(PDNS_STATS_URL, API_EXTENDED_URL + '/servers/localhost/zones/{0}'.format(domain.name)), headers=headers,
|
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 \
|
system_auto_ptr or \
|
||||||
domain_auto_ptr
|
domain_auto_ptr
|
||||||
):
|
):
|
||||||
result = self.add(domain_reverse_name, 'Master', 'INCEPTION-INCREMENT', '', '')
|
result = self.add(domain_reverse_name, 'Master', 'DEFAULT', '', '')
|
||||||
self.update()
|
self.update()
|
||||||
if result['status'] == 'ok':
|
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')
|
history = History(msg='Add reverse lookup domain {0}'.format(domain_reverse_name), detail=str({'domain_type': 'Master', 'domain_master_ips': ''}), created_by='System')
|
||||||
|
@ -63,27 +63,12 @@
|
|||||||
<label>SOA-EDIT-API</label>
|
<label>SOA-EDIT-API</label>
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="radio_type_soa_edit_api" id="radio_off" value="OFF" checked> (OFF)
|
<input type="radio" name="radio_type_soa_edit_api" id="radio_default" value="DEFAULT" checked> DEFAULT
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="radio_type_soa_edit_api" id="radio_inception_increment" value="INCEPTION-INCREMENT"> INCEPTION-INCREMENT
|
<input type="radio" name="radio_type_soa_edit_api" id="radio_increase" value="INCREASE"> INCREASE
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="radio">
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="radio_type_soa_edit_api" id="radio_inception" value="INCEPTION"> INCEPTION
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="radio">
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="radio_type_soa_edit_api" id="radio_increment_week" value="INCREMENT-WEEK"> INCREMENT-WEEK
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div class="radio">
|
|
||||||
<label>
|
|
||||||
<input type="radio" name="radio_type_soa_edit_api" id="radio_increment_weeks" value="INCREMENT-WEEKS"> INCREMENT-WEEKS
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
@ -93,7 +78,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
<label>
|
<label>
|
||||||
<input type="radio" name="radio_type_soa_edit_api" id="radio_inception_epoch" value="INCEPTION-EPOCH"> INCEPTION-EPOCH
|
<input type="radio" name="radio_type_soa_edit_api" id="radio_off" value="OFF"> OFF
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -132,28 +117,19 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
<dt>SOA-EDIT-API</dt>
|
<dt>SOA-EDIT-API</dt>
|
||||||
<dd>The SOA-EDIT-API setting defines when and how the SOA serial number will be updated after a change is made to the domain.
|
<dd>The SOA-EDIT-API setting defines how the SOA serial number will be updated after a change is made to the domain.
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
(OFF) - Not set
|
DEFAULT - Generate a soa serial of YYYYMMDD01. If the current serial is lower than the generated serial, use the generated serial. If the current serial is higher or equal to the generated serial, increase the current serial by 1.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCEPTION-INCREMENT - Uses YYYYMMDDSS format for SOA serial numbers. If the SOA serial from the backend is within two days after inception, it gets incremented by two (the backend should keep SS below 98).
|
INCREASE - Increase the current serial by 1.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCEPTION - Sets the SOA serial to the last inception time in YYYYMMDD01 format. Uses localtime to find the day for inception time. <strong>Not recomended.</strong>
|
EPOCH - Change the serial to the number of seconds since the EPOCH, aka unixtime.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCREMENT-WEEK - Sets the SOA serial to the number of weeks since the epoch, which is the last inception time in weeks. <strong>Not recomended.</strong>
|
OFF - Disable automatic updates of the SOA serial.
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
INCREMENT-WEEKS - Increments the serial with the number of weeks since the UNIX epoch. This should work in every setup; but the result won't look like YYYYMMDDSS anymore.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
EPOCH - Sets the SOA serial to the number of seconds since the epoch.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
INCEPTION-EPOCH - Sets the new SOA serial number to the maximum of the old SOA serial number, and age in seconds of the last inception.
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
|
@ -109,41 +109,29 @@
|
|||||||
<h3 class="box-title">Change SOA-EDIT-API</h3>
|
<h3 class="box-title">Change SOA-EDIT-API</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<p>The SOA-EDIT-API setting defines when and how the SOA serial number will be updated after a change is made to the domain.</p>
|
<p>The SOA-EDIT-API setting defines how the SOA serial number will be updated after a change is made to the domain.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
(OFF) - Not set
|
DEFAULT - Generate a soa serial of YYYYMMDD01. If the current serial is lower than the generated serial, use the generated serial. If the current serial is higher or equal to the generated serial, increase the current serial by 1.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCEPTION-INCREMENT - Uses YYYYMMDDSS format for SOA serial numbers. If the SOA serial from the backend is within two days after inception, it gets incremented by two (the backend should keep SS below 98).
|
INCREASE - Increase the current serial by 1.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCEPTION - Sets the SOA serial to the last inception time in YYYYMMDD01 format. Uses localtime to find the day for inception time. <strong>Not recomended.</strong>
|
EPOCH - Change the serial to the number of seconds since the EPOCH, aka unixtime.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
INCREMENT-WEEK - Sets the SOA serial to the number of weeks since the epoch, which is the last inception time in weeks. <strong>Not recomended.</strong>
|
OFF - Disable automatic updates of the SOA serial.
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
INCREMENT-WEEKS - Increments the serial with the number of weeks since the UNIX epoch. This should work in every setup; but the result won't look like YYYYMMDDSS anymore.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
EPOCH - Sets the SOA serial to the number of seconds since the epoch.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
INCEPTION-EPOCH - Sets the new SOA serial number to the maximum of the old SOA serial number, and age in seconds of the last inception.
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<b>New SOA-EDIT-API Setting:</b>
|
<b>New SOA-EDIT-API Setting:</b>
|
||||||
<form method="post" action="{{ url_for('domain_change_soa_edit_api', domain_name=domain.name) }}">
|
<form method="post" action="{{ url_for('domain_change_soa_edit_api', domain_name=domain.name) }}">
|
||||||
<select name="soa_edit_api" class="form-control" style="width:15em;">
|
<select name="soa_edit_api" class="form-control" style="width:15em;">
|
||||||
<option selected value="0">- Unchanged -</option>
|
<option selected value="0">- Unchanged -</option>
|
||||||
<option>OFF</option>
|
<option>DEFAULT</option>
|
||||||
<option>INCEPTION-INCREMENT</option>
|
<option>INCREASE</option>
|
||||||
<option>INCEPTION</option>
|
|
||||||
<option>INCREMENT-WEEK</option>
|
|
||||||
<option>INCREMENT-WEEKS</option>
|
|
||||||
<option>EPOCH</option>
|
<option>EPOCH</option>
|
||||||
<option>INCEPTION-EPOCH</option>
|
<option>OFF</option>
|
||||||
</select><br/>
|
</select><br/>
|
||||||
<button type="submit" class="btn btn-flat btn-primary" id="change_soa_edit_api">
|
<button type="submit" class="btn btn-flat btn-primary" id="change_soa_edit_api">
|
||||||
<i class="fa fa-check"></i> Change SOA-EDIT-API setting for {{ domain.name }}
|
<i class="fa fa-check"></i> Change SOA-EDIT-API setting for {{ domain.name }}
|
||||||
|
Loading…
Reference in New Issue
Block a user