summaryrefslogtreecommitdiff
path: root/src/conf_mode/dynamic_dns.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf_mode/dynamic_dns.py')
-rwxr-xr-xsrc/conf_mode/dynamic_dns.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/conf_mode/dynamic_dns.py b/src/conf_mode/dynamic_dns.py
index 90d4ff567..ff3c1f825 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 ###
@@ -38,8 +39,8 @@ cache=/var/cache/ddclient/ddclient.cache
#
# ddclient configuration for interface "{{ interface.interface }}":
#
-{% if interface.web_url and interface.web_skip -%}
-use=web, web={{ interface.web_url}}, web-skip={{ interface.web_skip }}
+{% if interface.web_url -%}
+use=web, web='{{ interface.web_url}}' {%- if interface.web_skip %}, web-skip='{{ interface.web_skip }}'{% endif %}
{% else -%}
use=if, if={{ interface.interface }}
{% endif -%}
@@ -63,6 +64,9 @@ protocol={{ srv.protocol }}
max-interval=28d
login={{ srv.login }}
password='{{ srv.password }}'
+{% if srv.server -%}
+server={{ srv.server }}
+{% endif -%}
{{ host }}
{% endfor %}
{% endfor %}
@@ -148,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]
@@ -242,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: