From ec604ef88e2845bcd75070f6dff325ccc50873aa Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 5 Feb 2019 07:40:43 +0100 Subject: T1231: Remove cache file of 'service dns dynamic' When deleting or changing "service dns dynamic" the cache file of ddclient is not removed, leading to abandoned host names which might be already gone. --- src/conf_mode/dynamic_dns.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (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 03b06f875..616b38b47 100755 --- a/src/conf_mode/dynamic_dns.py +++ b/src/conf_mode/dynamic_dns.py @@ -24,6 +24,7 @@ from vyos.config import Config from vyos import ConfigError config_file = r'/etc/ddclient.conf' +cache_file = r'/var/cache/ddclient/ddclient.cache' config_tmpl = """ ### Autogenerated by dynamic_dns.py ### @@ -151,7 +152,7 @@ def get_config(): 'server': '', 'custom' : False } - + # preload protocol from default service mapping if service in default_service_protocol.keys(): srv['protocol'] = default_service_protocol[service] @@ -245,6 +246,9 @@ def generate(dyndns): return None def apply(dyndns): + if os.path.exists(cache_file): + os.unlink(cache_file) + if dyndns is None: os.system('/etc/init.d/ddclient stop') else: -- cgit v1.2.3