protocol => protocole
This commit is contained in:
parent
4e04cfb8be
commit
3f4703827f
1 changed files with 12 additions and 12 deletions
24
main.py
24
main.py
|
@ -23,7 +23,7 @@ template_originv6 = "@ IN AAAA {ipv6}"
|
|||
template_ns = "@ IN NS {target}"
|
||||
template_mx = "@ IN MX {priority} {target}"
|
||||
template_txt = "{field1} IN TXT {field2}"
|
||||
template_srv = "_{service}._{protocol}.{zone} {ttl} IN SRV {priority} {weight} {port} {target}"
|
||||
template_srv = "_{service}._{protocole}.{zone} {ttl} IN SRV {priority} {weight} {port} {target}"
|
||||
template_a = "{hostname} IN A {ipv4}"
|
||||
template_aaaa = "{hostname} IN AAAA {ipv6}"
|
||||
template_cname = "{hostname} IN CNAME {alias}"
|
||||
|
@ -62,11 +62,11 @@ def write_dns_files(api_client):
|
|||
|
||||
now = datetime.datetime.now(datetime.timezone.utc)
|
||||
serial = now.strftime("%Y%m%d") + str(int(100*(now.hour*3600 + now.minute*60 + now.second)/86400))
|
||||
|
||||
|
||||
soa_mail_fields = zone['soa']['mail'].split('@')
|
||||
soa_mail = "{}.{}.".format(soa_mail_fields[0].replace('.', '\\.'),
|
||||
soa_mail_fields[1])
|
||||
|
||||
|
||||
soa = template_soa.format(zone=zone_name,
|
||||
mail=soa_mail,
|
||||
serial=serial,
|
||||
|
@ -74,33 +74,33 @@ def write_dns_files(api_client):
|
|||
retry=zone['soa']['retry'],
|
||||
expire=zone['soa']['expire'],
|
||||
ttl=zone['soa']['ttl'])
|
||||
|
||||
|
||||
originv4 = template_originv4.format(ipv4=zone['originv4']['ipv4'])
|
||||
if zone['originv6'] is not None:
|
||||
originv6 = template_originv6.format(ipv6=zone['originv6'])
|
||||
else:
|
||||
originv6 = ""
|
||||
|
||||
|
||||
ns_records = "\n".join(
|
||||
template_ns.format(target=x['target'])
|
||||
for x in zone['ns_records']
|
||||
)
|
||||
|
||||
|
||||
mx_records = "\n".join(
|
||||
template_mx.format(priority=x['priority'],
|
||||
target=x['target'])
|
||||
for x in zone['mx_records']
|
||||
)
|
||||
|
||||
|
||||
txt_records = "\n".join(
|
||||
template_txt.format(field1=x['field1'],
|
||||
field2=x['field2'])
|
||||
for x in zone['txt_records']
|
||||
)
|
||||
|
||||
|
||||
srv_records = "\n".join(
|
||||
template_srv.format(service=x['service'],
|
||||
protocol=x['protocol'],
|
||||
protocole=x['protocole'],
|
||||
zone=zone_name,
|
||||
ttl=x['ttl'],
|
||||
priority=x['priority'],
|
||||
|
@ -121,13 +121,13 @@ def write_dns_files(api_client):
|
|||
ipv6=x['ipv6'])
|
||||
for x in zone['aaaa_records'] if x['ipv6'] is not None
|
||||
)
|
||||
|
||||
|
||||
cname_records = "\n".join(
|
||||
template_cname.format(hostname=x['hostname'],
|
||||
alias=x['alias']+extension=x['extension'])
|
||||
for x in zone['cname_records']
|
||||
)
|
||||
|
||||
|
||||
zone_file_content = template_zone.format(soa=soa,
|
||||
originv4=originv4,
|
||||
originv6=originv6,
|
||||
|
@ -146,7 +146,7 @@ def write_dns_files(api_client):
|
|||
|
||||
def write_dns_reverse_file(api_client):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
api_client = Re2oAPIClient(api_hostname, api_username, api_password)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue