From 64a1b4cad2ad8b871db88f820e30ddfe59e21edd Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 26 Feb 2021 00:20:39 +0100 Subject: [PATCH] Misc fixes after testing --- debian/control | 2 +- src/yunohost/dyndns.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/debian/control b/debian/control index 7275cb7b1..ef5061fe7 100644 --- a/debian/control +++ b/debian/control @@ -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 diff --git a/src/yunohost/dyndns.py b/src/yunohost/dyndns.py index 6545d33c7..a921cfb5c 100644 --- a/src/yunohost/dyndns.py +++ b/src/yunohost/dyndns.py @@ -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'))