summaryrefslogtreecommitdiff
path: root/src/migration-scripts/dns-dynamic
diff options
context:
space:
mode:
Diffstat (limited to 'src/migration-scripts/dns-dynamic')
-rw-r--r--src/migration-scripts/dns-dynamic/1-to-27
1 files changed, 7 insertions, 0 deletions
diff --git a/src/migration-scripts/dns-dynamic/1-to-2 b/src/migration-scripts/dns-dynamic/1-to-2
index b4679769c..8aaedf210 100644
--- a/src/migration-scripts/dns-dynamic/1-to-2
+++ b/src/migration-scripts/dns-dynamic/1-to-2
@@ -17,6 +17,7 @@
# T5708:
# - migrate "service dns dynamic timeout ..."
# to "service dns dynamic interval ..."
+# - remove "service dns dynamic address <interface> web-options ..." when <interface> != "web"
import sys
from vyos.configtree import ConfigTree
@@ -34,6 +35,7 @@ config = ConfigTree(config_file)
base_path = ['service', 'dns', 'dynamic']
timeout_path = base_path + ['timeout']
+address_path = base_path + ['address']
if not config.exists(base_path):
# Nothing to do
@@ -44,6 +46,11 @@ if not config.exists(base_path):
if config.exists(timeout_path):
config.rename(timeout_path, 'interval')
+# Remove "service dns dynamic address <interface> web-options ..." when <interface> != "web"
+for address in config.list_nodes(address_path):
+ if config.exists(address_path + [address, 'web-options']) and address != 'web':
+ config.delete(address_path + [address, 'web-options'])
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())