|
1 | 1 | #!/usr/bin/env python3
|
2 | 2 | #
|
3 |
| -# Copyright (C) 2019 VyOS maintainers and contributors |
| 3 | +# Copyright (C) 2019-2024 VyOS maintainers and contributors |
4 | 4 | #
|
5 | 5 | # This program is free software; you can redistribute it and/or modify
|
6 | 6 | # it under the terms of the GNU General Public License version 2 or later as
|
|
30 | 30 | import vyos.defaults
|
31 | 31 | import vyos.remote
|
32 | 32 | from vyos.configsource import ConfigSourceSession, VyOSError
|
33 |
| -from vyos.migrator import Migrator, VirtualMigrator, MigratorError |
| 33 | +from vyos.migrate import ConfigMigrate |
34 | 34 |
|
35 | 35 | class LoadConfig(ConfigSourceSession):
|
36 | 36 | """A subclass for calling 'loadFile'.
|
@@ -81,22 +81,13 @@ def get_local_config(filename):
|
81 | 81 | with open(fp.name, 'w') as fd:
|
82 | 82 | fd.write(config_string)
|
83 | 83 |
|
84 |
| - virtual_migration = VirtualMigrator(fp.name) |
85 |
| - try: |
86 |
| - virtual_migration.run() |
87 |
| - except MigratorError as err: |
88 |
| - sys.exit('{}'.format(err)) |
89 |
| - |
90 |
| - migration = Migrator(fp.name) |
91 |
| - try: |
92 |
| - migration.run() |
93 |
| - except MigratorError as err: |
94 |
| - sys.exit('{}'.format(err)) |
| 84 | + config_migrate = ConfigMigrate(fp.name) |
| 85 | + config_migrate.run() |
95 | 86 |
|
96 | 87 | try:
|
97 | 88 | config.load_config(fp.name)
|
98 | 89 | except VyOSError as err:
|
99 |
| - sys.exit('{}'.format(err)) |
| 90 | + sys.exit(err) |
100 | 91 |
|
101 | 92 | if config.session_changed():
|
102 | 93 | print("Load complete. Use 'commit' to make changes effective.")
|
|
0 commit comments