mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
dyndns: During dyndns update, first make sure we have an ipv4 or ipv6 to avoid the remaining code miserably crashing
This commit is contained in:
parent
f7cea60a30
commit
e8e2cee030
1 changed files with 10 additions and 10 deletions
|
@ -203,6 +203,16 @@ def dyndns_update(
|
||||||
|
|
||||||
key = keys[0]
|
key = keys[0]
|
||||||
|
|
||||||
|
# Get current IPv4 and IPv6
|
||||||
|
ipv4 = get_public_ip()
|
||||||
|
ipv6 = get_public_ip(6)
|
||||||
|
|
||||||
|
if ipv4 is None and ipv6 is None:
|
||||||
|
logger.debug(
|
||||||
|
"No ipv4 nor ipv6 ?! Sounds like the server is not connected to the internet, or the ip.yunohost.org infrastructure is down somehow"
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
# Extract 'host', e.g. 'nohost.me' from 'foo.nohost.me'
|
# Extract 'host', e.g. 'nohost.me' from 'foo.nohost.me'
|
||||||
host = domain.split(".")[1:]
|
host = domain.split(".")[1:]
|
||||||
host = ".".join(host)
|
host = ".".join(host)
|
||||||
|
@ -259,19 +269,9 @@ def dyndns_update(
|
||||||
old_ipv4 = resolve_domain(domain, "A")
|
old_ipv4 = resolve_domain(domain, "A")
|
||||||
old_ipv6 = resolve_domain(domain, "AAAA")
|
old_ipv6 = resolve_domain(domain, "AAAA")
|
||||||
|
|
||||||
# Get current IPv4 and IPv6
|
|
||||||
ipv4 = get_public_ip()
|
|
||||||
ipv6 = get_public_ip(6)
|
|
||||||
|
|
||||||
logger.debug("Old IPv4/v6 are (%s, %s)" % (old_ipv4, old_ipv6))
|
logger.debug("Old IPv4/v6 are (%s, %s)" % (old_ipv4, old_ipv6))
|
||||||
logger.debug("Requested IPv4/v6 are (%s, %s)" % (ipv4, ipv6))
|
logger.debug("Requested IPv4/v6 are (%s, %s)" % (ipv4, ipv6))
|
||||||
|
|
||||||
if ipv4 is None and ipv6 is None:
|
|
||||||
logger.debug(
|
|
||||||
"No ipv4 nor ipv6 ?! Sounds like the server is not connected to the internet, or the ip.yunohost.org infrastructure is down somehow"
|
|
||||||
)
|
|
||||||
return
|
|
||||||
|
|
||||||
# no need to update
|
# no need to update
|
||||||
if (not force and not dry_run) and (old_ipv4 == ipv4 and old_ipv6 == ipv6):
|
if (not force and not dry_run) and (old_ipv4 == ipv4 and old_ipv6 == ipv6):
|
||||||
logger.info("No updated needed.")
|
logger.info("No updated needed.")
|
||||||
|
|
Loading…
Add table
Reference in a new issue