diff options
author | FileGo <emilnovak@gmail.com> | 2021-05-18 20:24:28 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-05-18 21:25:59 +0200 |
commit | 6816d37501aa495d71a441a8e391a1249c4d13f6 (patch) | |
tree | c8292f85fe2fdee9e14b8cab6dcc60645c030037 /src | |
parent | 935914b815012639af3910359a7f695de2052018 (diff) | |
download | vyos-1x-6816d37501aa495d71a441a8e391a1249c4d13f6.tar.gz vyos-1x-6816d37501aa495d71a441a8e391a1249c4d13f6.zip |
ddns: T3254: fix incorrect update time
This fixes a bug when show dynamic dns status returned (formatted) UNIX
time 0. I have changed the code to use ddclient's mtime value in the cache
file, which is updated on every successful sync with DDNS service as opposed
to atime, which was previously used.
(cherry picked from commit 89b127647cbf3fea3a439f43efa32a31aa03524e)
Diffstat (limited to 'src')
-rwxr-xr-x | src/op_mode/dynamic_dns.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/op_mode/dynamic_dns.py b/src/op_mode/dynamic_dns.py index f9a1aad38..263a3b6a5 100755 --- a/src/op_mode/dynamic_dns.py +++ b/src/op_mode/dynamic_dns.py @@ -65,11 +65,10 @@ def show_status(): if ip: outp['ip'] = ip.split(',')[0] - if 'atime=' in line: - atime = line.split('atime=')[1] - if atime: - tmp = atime.split(',')[0] - outp['time'] = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(tmp, base=10))) + if 'mtime=' in line: + mtime = line.split('mtime=')[1] + if mtime: + outp['time'] = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(int(mtime.split(',')[0], base=10))) if 'status=' in line: status = line.split('status=')[1] |