mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-28 20:54:38 +00:00
Fix #613. Create domain from template with SOA record enabled
This commit is contained in:
parent
59110432a0
commit
93cd64ac75
@ -249,7 +249,7 @@ class Record(object):
|
|||||||
del_rrsets = {"rrsets": []}
|
del_rrsets = {"rrsets": []}
|
||||||
for r in current_rrsets:
|
for r in current_rrsets:
|
||||||
if r not in submitted_rrsets and r['type'] in Setting(
|
if r not in submitted_rrsets and r['type'] in Setting(
|
||||||
).get_records_allow_to_edit():
|
).get_records_allow_to_edit() and r['type'] != 'SOA':
|
||||||
r['changetype'] = 'DELETE'
|
r['changetype'] = 'DELETE'
|
||||||
del_rrsets["rrsets"].append(r)
|
del_rrsets["rrsets"].append(r)
|
||||||
|
|
||||||
@ -286,7 +286,11 @@ class Record(object):
|
|||||||
current_app.logger.error(
|
current_app.logger.error(
|
||||||
'Cannot apply record changes with deleting rrsets step. PDNS error: {}'
|
'Cannot apply record changes with deleting rrsets step. PDNS error: {}'
|
||||||
.format(jdata1['error']))
|
.format(jdata1['error']))
|
||||||
return {'status': 'error', 'msg': jdata1['error']}
|
print(jdata1['error'])
|
||||||
|
return {
|
||||||
|
'status': 'error',
|
||||||
|
'msg': jdata1['error'].replace("'", "")
|
||||||
|
}
|
||||||
|
|
||||||
if new_rrsets["rrsets"]:
|
if new_rrsets["rrsets"]:
|
||||||
jdata2 = utils.fetch_json(
|
jdata2 = utils.fetch_json(
|
||||||
@ -301,7 +305,10 @@ class Record(object):
|
|||||||
current_app.logger.error(
|
current_app.logger.error(
|
||||||
'Cannot apply record changes with adding rrsets step. PDNS error: {}'
|
'Cannot apply record changes with adding rrsets step. PDNS error: {}'
|
||||||
.format(jdata2['error']))
|
.format(jdata2['error']))
|
||||||
return {'status': 'error', 'msg': jdata2['error']}
|
return {
|
||||||
|
'status': 'error',
|
||||||
|
'msg': jdata2['error'].replace("'", "")
|
||||||
|
}
|
||||||
|
|
||||||
self.auto_ptr(domain_name, new_rrsets, del_rrsets)
|
self.auto_ptr(domain_name, new_rrsets, del_rrsets)
|
||||||
self.update_db_serial(domain_name)
|
self.update_db_serial(domain_name)
|
||||||
|
@ -199,16 +199,25 @@ def add():
|
|||||||
result = r.apply(domain_name, record_data)
|
result = r.apply(domain_name, record_data)
|
||||||
if result['status'] == 'ok':
|
if result['status'] == 'ok':
|
||||||
history = History(
|
history = History(
|
||||||
msg=
|
msg='Applying template {0} to {1} successfully.'.
|
||||||
'Applying template {0} to {1}, created records successfully.'
|
format(template.name, domain_name),
|
||||||
.format(template.name, domain_name),
|
detail=str(
|
||||||
detail=str(result),
|
json.dumps({
|
||||||
|
"domain":
|
||||||
|
domain_name,
|
||||||
|
"template":
|
||||||
|
template.name,
|
||||||
|
"add_rrests":
|
||||||
|
result['data'][0]['rrsets'],
|
||||||
|
"del_rrests":
|
||||||
|
result['data'][1]['rrsets']
|
||||||
|
})),
|
||||||
created_by=current_user.username)
|
created_by=current_user.username)
|
||||||
history.add()
|
history.add()
|
||||||
else:
|
else:
|
||||||
history = History(
|
history = History(
|
||||||
msg=
|
msg=
|
||||||
'Applying template {0} to {1}, FAILED to created records.'
|
'Failed to apply template {0} to {1}.'
|
||||||
.format(template.name, domain_name),
|
.format(template.name, domain_name),
|
||||||
detail=str(result),
|
detail=str(result),
|
||||||
created_by=current_user.username)
|
created_by=current_user.username)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user