✨ Add CNAME handler
This commit is contained in:
parent
f18d1496b8
commit
2fa0aece48
1 changed files with 20 additions and 1 deletions
21
lib.py
21
lib.py
|
@ -289,6 +289,25 @@ def aaaa_records_handler(re2o_zone, dns_zone):
|
||||||
add_to_zone(dns_zone, key_name, AAAA_obj)
|
add_to_zone(dns_zone, key_name, AAAA_obj)
|
||||||
|
|
||||||
|
|
||||||
|
def cname_records_handler(re2o_zone, dns_zone):
|
||||||
|
"""Handler fo CNAME records"""
|
||||||
|
|
||||||
|
for record in re2o_zone["cname_records"]:
|
||||||
|
|
||||||
|
logging.debug(f"CNAME = {record}")
|
||||||
|
|
||||||
|
target = dns.name.from_text(record["alias"])
|
||||||
|
name = dns.name.from_text(record["hostname"], origin=None)
|
||||||
|
|
||||||
|
CNAME_obj = CNAME.CNAME(
|
||||||
|
dns.rdataclass.IN,
|
||||||
|
dns.rdatatype.CNAME,
|
||||||
|
target
|
||||||
|
)
|
||||||
|
|
||||||
|
add_to_zone(dns_zone, name, CNAME_obj)
|
||||||
|
|
||||||
|
|
||||||
def pass_handler(zone, records):
|
def pass_handler(zone, records):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -305,6 +324,6 @@ HANDLERS = {
|
||||||
"a_records": a_records_handler,
|
"a_records": a_records_handler,
|
||||||
"aaaa_records": aaaa_records_handler,
|
"aaaa_records": aaaa_records_handler,
|
||||||
"name": pass_handler,
|
"name": pass_handler,
|
||||||
"cname_records": pass_handler,
|
"cname_records": cname_records_handler,
|
||||||
"dname_records": pass_handler,
|
"dname_records": pass_handler,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue