From 271fcff986c11e3300f3abd66c603a125abd8dd1 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Wed, 19 Jun 2024 20:55:03 -0500 Subject: migration: T6007: update vyos-load-config.py --- src/helpers/vyos-load-config.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/helpers/vyos-load-config.py b/src/helpers/vyos-load-config.py index 4ec865454..16083fd41 100755 --- a/src/helpers/vyos-load-config.py +++ b/src/helpers/vyos-load-config.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2019 VyOS maintainers and contributors +# Copyright (C) 2019-2024 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -30,7 +30,8 @@ import tempfile import vyos.defaults import vyos.remote from vyos.configsource import ConfigSourceSession, VyOSError -from vyos.migrator import Migrator, VirtualMigrator, MigratorError +from vyos.migrate import ConfigMigrate +from vyos.migrate import ConfigMigrateError class LoadConfig(ConfigSourceSession): """A subclass for calling 'loadFile'. @@ -81,22 +82,16 @@ with tempfile.NamedTemporaryFile() as fp: with open(fp.name, 'w') as fd: fd.write(config_string) - virtual_migration = VirtualMigrator(fp.name) + config_migrate = ConfigMigrate(fp.name) try: - virtual_migration.run() - except MigratorError as err: - sys.exit('{}'.format(err)) - - migration = Migrator(fp.name) - try: - migration.run() - except MigratorError as err: - sys.exit('{}'.format(err)) + config_migrate.run() + except ConfigMigrateError as err: + sys.exit(err) try: config.load_config(fp.name) except VyOSError as err: - sys.exit('{}'.format(err)) + sys.exit(err) if config.session_changed(): print("Load complete. Use 'commit' to make changes effective.") -- cgit v1.2.3