mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
Fix issue where records could get deleted when different TTL.
This commit is contained in:
parent
0d1aa7971b
commit
28796ed286
@ -858,8 +858,8 @@ class Record(object):
|
|||||||
record = {
|
record = {
|
||||||
"name": r['name'] + '.',
|
"name": r['name'] + '.',
|
||||||
"type": r['type'],
|
"type": r['type'],
|
||||||
"ttl": r['ttl'],
|
|
||||||
"changetype": "REPLACE",
|
"changetype": "REPLACE",
|
||||||
|
"ttl": r['ttl'],
|
||||||
"records": [
|
"records": [
|
||||||
{
|
{
|
||||||
"content": r['content'],
|
"content": r['content'],
|
||||||
@ -888,14 +888,14 @@ class Record(object):
|
|||||||
|
|
||||||
# Adjustment to add multiple records which described in https://github.com/ngoduykhanh/PowerDNS-Admin/issues/5#issuecomment-181637576
|
# Adjustment to add multiple records which described in https://github.com/ngoduykhanh/PowerDNS-Admin/issues/5#issuecomment-181637576
|
||||||
final_records = []
|
final_records = []
|
||||||
records = sorted(records, key = lambda item: (item["name"], item["type"]))
|
records = sorted(records, key = lambda item: (item["name"], item["type"], item["changetype"]))
|
||||||
for key, group in itertools.groupby(records, lambda item: (item["name"], item["type"], item["changetype"], item["ttl"])):
|
for key, group in itertools.groupby(records, lambda item: (item["name"], item["type"], item["changetype"])):
|
||||||
if NEW_SCHEMA:
|
if NEW_SCHEMA:
|
||||||
new_record = {
|
new_record = {
|
||||||
"name": key[0],
|
"name": key[0],
|
||||||
"type": key[1],
|
"type": key[1],
|
||||||
"changetype": key[2],
|
"changetype": key[2],
|
||||||
"ttl": key[3],
|
"ttl": None,
|
||||||
"records": []
|
"records": []
|
||||||
}
|
}
|
||||||
for item in group:
|
for item in group:
|
||||||
@ -905,6 +905,8 @@ class Record(object):
|
|||||||
if temp_content.strip()[-1:] != '.':
|
if temp_content.strip()[-1:] != '.':
|
||||||
temp_content += '.'
|
temp_content += '.'
|
||||||
|
|
||||||
|
if new_record['ttl'] is None:
|
||||||
|
new_record['ttl'] = item['ttl']
|
||||||
new_record['records'].append({
|
new_record['records'].append({
|
||||||
"content": temp_content,
|
"content": temp_content,
|
||||||
"disabled": temp_disabled
|
"disabled": temp_disabled
|
||||||
|
Loading…
Reference in New Issue
Block a user