mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-28 14:05:41 +00:00
Add reverse PTR record adding to reverse domain
At this point we just create the new records and we don't care about the record updates, so now this is a little bit buggy.
This commit is contained in:
parent
0e8a41f58e
commit
3d7511f013
@ -1017,14 +1017,20 @@ class Record(object):
|
|||||||
return {'status': 'error', 'msg': jdata2['error']}
|
return {'status': 'error', 'msg': jdata2['error']}
|
||||||
else:
|
else:
|
||||||
logging.info('Record was applied successfully.')
|
logging.info('Record was applied successfully.')
|
||||||
|
d = Domain()
|
||||||
for r in new_records:
|
for r in new_records:
|
||||||
r_name = r['name'] + '.'
|
|
||||||
if r['type'] in ['A', 'AAAA']:
|
if r['type'] in ['A', 'AAAA']:
|
||||||
|
r_name = r['name'] + '.'
|
||||||
r_content = r['content']
|
r_content = r['content']
|
||||||
temp = re.search('^(([a-f0-9]\.){4}(?P<ipv6name>.+6.arpa)\.?)|(\.(?P<ipv4name>.+r.arpa)\.?)', dns.reversename.from_address(r_content).to_text())
|
temp = re.search('^(([a-f0-9]\.){4}(?P<ipv6name>.+6.arpa)\.?)|(\.(?P<ipv4name>.+r.arpa)\.?)', dns.reversename.from_address(r_content).to_text())
|
||||||
domain_reverse_name = temp.group('ipv6name') if temp.group('ipv6name') != None else temp.group('ipv4name')
|
domain_reverse_name = temp.group('ipv6name') if temp.group('ipv6name') != None else temp.group('ipv4name')
|
||||||
d = Domain()
|
|
||||||
d.create_reverse_domain(domain, domain_reverse_name)
|
d.create_reverse_domain(domain, domain_reverse_name)
|
||||||
|
self.name = dns.reversename.from_address(r_content).to_text().rstrip('.')
|
||||||
|
self.type = 'PTR'
|
||||||
|
self.status = r['disabled']
|
||||||
|
self.ttl = r['ttl']
|
||||||
|
self.data = r_name
|
||||||
|
self.add(domain_reverse_name)
|
||||||
return {'status': 'ok', 'msg': 'Record was applied successfully'}
|
return {'status': 'ok', 'msg': 'Record was applied successfully'}
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logging.error("Cannot apply record changes to domain %s. DETAIL: %s" % (str(e), domain))
|
logging.error("Cannot apply record changes to domain %s. DETAIL: %s" % (str(e), domain))
|
||||||
|
Loading…
Reference in New Issue
Block a user