summaryrefslogtreecommitdiff
path: root/src/migration-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/migration-scripts')
-rwxr-xr-xsrc/migration-scripts/dns-forwarding/1-to-210
1 files changed, 8 insertions, 2 deletions
diff --git a/src/migration-scripts/dns-forwarding/1-to-2 b/src/migration-scripts/dns-forwarding/1-to-2
index 31ba5573f..9a50b6aa3 100755
--- a/src/migration-scripts/dns-forwarding/1-to-2
+++ b/src/migration-scripts/dns-forwarding/1-to-2
@@ -23,8 +23,8 @@
import sys
from ipaddress import ip_interface
+from vyos.ifconfig import Interface
from vyos.configtree import ConfigTree
-from vyos.interfaces import get_type_of_interface
if (len(sys.argv) < 1):
print("Must specify file name!")
@@ -41,7 +41,10 @@ base = ['service', 'dns', 'forwarding']
if not config.exists(base):
# Nothing to do
sys.exit(0)
+
else:
+ # XXX: we can remove the else and un-indent this whole block
+
if config.exists(base + ['listen-on']):
listen_intf = config.return_values(base + ['listen-on'])
# Delete node with abandoned command
@@ -60,7 +63,10 @@ else:
# this is a QinQ VLAN interface
intf = intf.split('.')[0] + ' vif-s ' + intf.split('.')[1] + ' vif-c ' + intf.split('.')[2]
- path = ['interfaces', get_type_of_interface(intf), intf, 'address']
+ section = Interface.section(intf)
+ if not section:
+ raise ValueError(f'Invalid interface name {intf}')
+ path = ['interfaces', section, intf, 'address']
# retrieve corresponding interface addresses in CIDR format
# those need to be converted in pure IP addresses without network information