Skip to content

Commit d47e6cd

Browse files
committed
migration: T6007: update vyos-load-config.py
1 parent 5726d84 commit d47e6cd

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/helpers/vyos-load-config.py

+5-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (C) 2019 VyOS maintainers and contributors
3+
# Copyright (C) 2019-2024 VyOS maintainers and contributors
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License version 2 or later as
@@ -30,7 +30,7 @@
3030
import vyos.defaults
3131
import vyos.remote
3232
from vyos.configsource import ConfigSourceSession, VyOSError
33-
from vyos.migrator import Migrator, VirtualMigrator, MigratorError
33+
from vyos.migrate import ConfigMigrate
3434

3535
class LoadConfig(ConfigSourceSession):
3636
"""A subclass for calling 'loadFile'.
@@ -81,22 +81,13 @@ def get_local_config(filename):
8181
with open(fp.name, 'w') as fd:
8282
fd.write(config_string)
8383

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()
9586

9687
try:
9788
config.load_config(fp.name)
9889
except VyOSError as err:
99-
sys.exit('{}'.format(err))
90+
sys.exit(err)
10091

10192
if config.session_changed():
10293
print("Load complete. Use 'commit' to make changes effective.")

0 commit comments

Comments
 (0)