From 29efbf51efea559773f61703f11a77a8aee6de36 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 11 Jan 2022 12:01:23 +0100 Subject: migrator: interfaces: T4171: bugfix ConfigTreeError Migrating 1.2.8 -> 1.4-rolling-202201110811 vyos-router[970]: Waiting for NICs to settle down: settled in 0sec.. vyos-router[1085]: Started watchfrr. vyos-router[970]: Mounting VyOS Config...done. vyos-router[970]: Starting VyOS router: migrate vyos-router[1490]: Traceback (most recent call last): vyos-router[1490]: File "/opt/vyatta/etc/config-migrate/migrate/interfaces/5-to-6", line 112, in vyos-router[1490]: for if_type in config.list_nodes(['interfaces']): vyos-router[1490]: File "/usr/lib/python3/dist-packages/vyos/configtree.py", line 236, in list_nodes vyos-router[1490]: raise ConfigTreeError("Path [{}] doesn't exist".format(path_str)) vyos-router[1490]: vyos.configtree.ConfigTreeError: Path [b'interfaces'] doesn't exist vyos-router[1455]: Migration script error: /opt/vyatta/etc/config-migrate/migrate/interfaces/5-to-6: Command '['/opt/vyatta/etc/config-migrate/migrate/interfaces/5-to-6', '/opt/vyatta/etc/config/config.boot']' returned non-zero exit status 1.. vyos-router[970]: configure. vyos-config[979]: Configuration success --- src/migration-scripts/interfaces/5-to-6 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/migration-scripts/interfaces/5-to-6') diff --git a/src/migration-scripts/interfaces/5-to-6 b/src/migration-scripts/interfaces/5-to-6 index ae79c1d1b..dc8d9554f 100755 --- a/src/migration-scripts/interfaces/5-to-6 +++ b/src/migration-scripts/interfaces/5-to-6 @@ -107,10 +107,15 @@ if __name__ == '__main__': config_file = f.read() config = ConfigTree(config_file) + base = ['interfaces'] + + if not config.exists(base): + # Nothing to do + exit(0) # list all individual interface types like dummy, ethernet and so on - for if_type in config.list_nodes(['interfaces']): - base_if_type = ['interfaces', if_type] + for if_type in config.list_nodes(base): + base_if_type = base + [if_type] # for every individual interface we need to check if there is an # ipv6 ra configured ... and also for every VIF (VLAN) interface -- cgit v1.2.3