mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
dyndns update: Fix for ipv6-only hosts
This commit is contained in:
parent
ebed745140
commit
a61d023198
1 changed files with 9 additions and 5 deletions
|
@ -257,13 +257,17 @@ def dyndns_update(
|
||||||
|
|
||||||
def resolve_domain(domain, rdtype):
|
def resolve_domain(domain, rdtype):
|
||||||
|
|
||||||
# FIXME make this work for IPv6-only hosts too..
|
|
||||||
ok, result = dig(dyn_host, "A")
|
ok, result = dig(dyn_host, "A")
|
||||||
dyn_host_ip = result[0] if ok == "ok" and len(result) else None
|
dyn_host_ipv4 = result[0] if ok == "ok" and len(result) else None
|
||||||
if not dyn_host_ip:
|
if not dyn_host_ipv4:
|
||||||
raise YunohostError("Failed to resolve %s" % dyn_host, raw_msg=True)
|
raise YunohostError("Failed to resolve IPv4 for %s ?" % dyn_host, raw_msg=True)
|
||||||
|
|
||||||
|
ok, result = dig(dyn_host, "AAAA")
|
||||||
|
dyn_host_ipv6 = result[0] if ok == "ok" and len(result) else None
|
||||||
|
if not dyn_host_ipv6:
|
||||||
|
raise YunohostError("Failed to resolve IPv6 for %s ?" % dyn_host, raw_msg=True)
|
||||||
|
|
||||||
ok, result = dig(domain, rdtype, resolvers=[dyn_host_ip])
|
ok, result = dig(domain, rdtype, resolvers=[dyn_host_ipv4, dyn_host_ipv6])
|
||||||
if ok == "ok":
|
if ok == "ok":
|
||||||
return result[0] if len(result) else None
|
return result[0] if len(result) else None
|
||||||
elif result[0] == "Timeout":
|
elif result[0] == "Timeout":
|
||||||
|
|
Loading…
Add table
Reference in a new issue