diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-09-03 22:16:11 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-09-03 22:16:16 +0200 |
commit | 33684c1a645e5b9124a8a8630e8f3c168420d23e (patch) | |
tree | 010e380ba9be0364cacaacf16b76ea5c947259ec /src/conf_mode/dynamic_dns.py | |
parent | 1bb1a388dba4b2e21ca20de78317d853bea10845 (diff) | |
download | vyos-1x-33684c1a645e5b9124a8a8630e8f3c168420d23e.tar.gz vyos-1x-33684c1a645e5b9124a8a8630e8f3c168420d23e.zip |
ddclient: T2852: bugfix service deletion
When service was deleted we tried accessing a dictionary which was actually of
type None which is not possible.
Diffstat (limited to 'src/conf_mode/dynamic_dns.py')
-rwxr-xr-x | src/conf_mode/dynamic_dns.py | 14 |
1 files changed, 6 insertions, 8 deletions
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__': |