Misc fixes after testing

This commit is contained in:
Alexandre Aubin 2021-02-26 00:20:39 +01:00
parent 071732dd7f
commit 64a1b4cad2
2 changed files with 7 additions and 6 deletions

2
debian/control vendored
View file

@ -27,7 +27,7 @@ Depends: ${python3:Depends}, ${misc:Depends}
, redis-server
, metronome (>=3.14.0)
, acl
, git, curl, wget, cron, unzip, jq, bc
, git, curl, wget, cron, unzip, jq, bc, at
, lsb-release, haveged, fake-hwclock, equivs, lsof, whois
Recommends: yunohost-admin
, ntp, inetutils-ping | iputils-ping

View file

@ -123,7 +123,7 @@ def dyndns_subscribe(
"""
if _guess_current_dyndns_domain(dyn_host) != (None, None):
if _guess_current_dyndns_domain(subscribe_host) != (None, None):
raise YunohostError('domain_dyndns_already_subscribed')
if domain is None:
@ -169,7 +169,7 @@ def dyndns_subscribe(
try:
r = requests.post(
"https://%s/key/%s?key_algo=hmac-sha512"
% (subscribe_host, base64.b64encode(key)),
% (subscribe_host, base64.b64encode(key.encode()).decode()),
data={"subdomain": domain},
timeout=30,
)
@ -188,13 +188,14 @@ def dyndns_subscribe(
# Yunohost regen conf will add the dyndns cron job if a private key exists
# in /etc/yunohost/dyndns
regen_conf("yunohost")
regen_conf(["yunohost"])
# Add some dyndns update in 2 and 4 minutes from now such that user should
# not have to wait 10ish minutes for the conf to propagate
cmd = "at -M now + {t} >/dev/null 2>&1 <<< \"/bin/bash -c 'yunohost dyndns update'\""
subprocess.check_call(cmd.format(t="2 min"), shell=True)
subprocess.check_call(cmd.format(t="4 min"), shell=True)
# For some reason subprocess doesn't like the redirections so we have to use bash -c explicity...
subprocess.check_call(["bash", "-c", cmd.format(t="2 min")])
subprocess.check_call(["bash", "-c", cmd.format(t="4 min")])
logger.success(m18n.n('dyndns_registered'))