mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
dyndns: fix dyndns_update, needs to construct the update object using the target zone, not the domain itself
This commit is contained in:
parent
5479befabb
commit
ecb8419ee0
1 changed files with 8 additions and 4 deletions
|
@ -219,8 +219,8 @@ def dyndns_update(
|
||||||
return
|
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:]
|
zone = domain.split(".")[1:]
|
||||||
host = ".".join(host)
|
zone = ".".join(zone)
|
||||||
|
|
||||||
logger.debug("Building zone update ...")
|
logger.debug("Building zone update ...")
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ def dyndns_update(
|
||||||
|
|
||||||
keyring = dns.tsigkeyring.from_text({f'{domain}.': key})
|
keyring = dns.tsigkeyring.from_text({f'{domain}.': key})
|
||||||
# Python's dns.update is similar to the old nsupdate cli tool
|
# Python's dns.update is similar to the old nsupdate cli tool
|
||||||
update = dns.update.Update(domain, keyring=keyring, keyalgorithm=dns.tsig.HMAC_SHA512)
|
update = dns.update.Update(zone, keyring=keyring, keyalgorithm=dns.tsig.HMAC_SHA512)
|
||||||
|
|
||||||
auth_resolvers = []
|
auth_resolvers = []
|
||||||
|
|
||||||
|
@ -322,11 +322,15 @@ def dyndns_update(
|
||||||
|
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
try:
|
try:
|
||||||
dns.query.tcp(update, auth_resolvers[0])
|
r = dns.query.tcp(update, auth_resolvers[0])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
raise YunohostError("dyndns_ip_update_failed")
|
raise YunohostError("dyndns_ip_update_failed")
|
||||||
|
|
||||||
|
if "rcode NOERROR" not in str(r):
|
||||||
|
logger.error(str(r))
|
||||||
|
raise YunohostError("dyndns_ip_update_failed")
|
||||||
|
|
||||||
logger.success(m18n.n("dyndns_ip_updated"))
|
logger.success(m18n.n("dyndns_ip_updated"))
|
||||||
else:
|
else:
|
||||||
print(
|
print(
|
||||||
|
|
Loading…
Add table
Reference in a new issue