summaryrefslogtreecommitdiff
path: root/src/helpers/vyos-merge-config.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-06-23 15:53:36 -0500
committerJohn Estabrook <jestabro@vyos.io>2024-09-11 12:00:36 -0500
commitefe2508f891282d207d141282815aa81e7db9d34 (patch)
tree1ad5ffb520885ff4ad4bafa6e0273f5b7c218af6 /src/helpers/vyos-merge-config.py
parentd17304ba5e9396eff87ca772d3962db29b54c598 (diff)
downloadvyos-1x-efe2508f891282d207d141282815aa81e7db9d34.tar.gz
vyos-1x-efe2508f891282d207d141282815aa81e7db9d34.zip
migration: T6007: update vyos-merge-config.py
(cherry picked from commit f67753bf10ac217040aa7d86117fb44c7b743327)
Diffstat (limited to 'src/helpers/vyos-merge-config.py')
-rwxr-xr-xsrc/helpers/vyos-merge-config.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/helpers/vyos-merge-config.py b/src/helpers/vyos-merge-config.py
index 35424626e..5ef845ac2 100755
--- a/src/helpers/vyos-merge-config.py
+++ b/src/helpers/vyos-merge-config.py
@@ -22,7 +22,8 @@ import vyos.remote
from vyos.config import Config
from vyos.configtree import ConfigTree
-from vyos.migrator import Migrator, VirtualMigrator
+from vyos.migrate import ConfigMigrate
+from vyos.migrate import ConfigMigrateError
from vyos.utils.process import cmd
from vyos.utils.process import DEVNULL
@@ -61,15 +62,11 @@ with tempfile.NamedTemporaryFile() as file_to_migrate:
with open(file_to_migrate.name, 'w') as fd:
fd.write(config_file)
- virtual_migration = VirtualMigrator(file_to_migrate.name)
- virtual_migration.run()
-
- migration = Migrator(file_to_migrate.name)
- migration.run()
-
- if virtual_migration.config_changed() or migration.config_changed():
- with open(file_to_migrate.name, 'r') as fd:
- config_file = fd.read()
+ config_migrate = ConfigMigrate(file_to_migrate.name)
+ try:
+ config_migrate.run()
+ except ConfigMigrateError as e:
+ sys.exit(e)
merge_config_tree = ConfigTree(config_file)