diff options
author | Daniil Baturin <daniil@vyos.io> | 2024-09-12 13:59:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-12 13:59:18 +0100 |
commit | 205d957d092ade5708cc2182381864c04e4c0aff (patch) | |
tree | e78636efaa1332c5d49e1c2f023721dc030f8d6a /src/helpers/vyos-load-config.py | |
parent | 9652bfda0a7f3e7932aecb32262c34f3fede72b2 (diff) | |
parent | eaa9c82670fa5ee90835266e6f7a24f81c49d17e (diff) | |
download | vyos-1x-205d957d092ade5708cc2182381864c04e4c0aff.tar.gz vyos-1x-205d957d092ade5708cc2182381864c04e4c0aff.zip |
Merge pull request #4050 from jestabro/revise-migration-circinus
T6007: revise migration system
Diffstat (limited to 'src/helpers/vyos-load-config.py')
-rwxr-xr-x | src/helpers/vyos-load-config.py | 21 |
1 files changed, 8 insertions, 13 deletions
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.") |