From 33684c1a645e5b9124a8a8630e8f3c168420d23e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 3 Sep 2020 22:16:11 +0200 Subject: ddclient: T2852: bugfix service deletion When service was deleted we tried accessing a dictionary which was actually of type None which is not possible. --- src/conf_mode/dynamic_dns.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/conf_mode/dynamic_dns.py') diff --git a/src/conf_mode/dynamic_dns.py b/src/conf_mode/dynamic_dns.py index 7c3b9ff6a..5cf526434 100755 --- a/src/conf_mode/dynamic_dns.py +++ b/src/conf_mode/dynamic_dns.py @@ -258,19 +258,17 @@ def generate(dyndns): return None def apply(dyndns): - if os.path.exists(dyndns['cache_file']): - os.unlink(dyndns['cache_file']) - - if os.path.exists('/etc/ddclient.conf'): - os.unlink('/etc/ddclient.conf') - if dyndns is None: os.system('/etc/init.d/ddclient stop') + if os.path.exists(config_file): + os.unlink(config_file) + else: if os.path.exists(dyndns['pid_file']): os.unlink(dyndns['pid_file']) - else: - os.system('/etc/init.d/ddclient restart') + if os.path.exists(dyndns['cache_file']): + os.unlink(dyndns['cache_file']) + os.system('/etc/init.d/ddclient restart') return None if __name__ == '__main__': -- cgit v1.2.3