diff options
-rw-r--r-- | python/vyos/migrator.py | 3 | ||||
-rwxr-xr-x | src/helpers/run-config-migration.py | 19 |
2 files changed, 14 insertions, 8 deletions
diff --git a/python/vyos/migrator.py b/python/vyos/migrator.py index e60d862ff..7d77e6bac 100644 --- a/python/vyos/migrator.py +++ b/python/vyos/migrator.py @@ -209,8 +209,7 @@ class VirtualMigrator(Migrator): cfg_versions = self.read_config_file_versions() if not cfg_versions: - raise MigratorError("Config file has no version information;" - " virtual migration not possible.") + return if self.update_vintage(): self._changed = True diff --git a/src/helpers/run-config-migration.py b/src/helpers/run-config-migration.py index 6ffd038f3..3c06e38f8 100755 --- a/src/helpers/run-config-migration.py +++ b/src/helpers/run-config-migration.py @@ -69,15 +69,22 @@ def main(): sys.exit(1) if not virtual: - migration = Migrator(config_file_name, force=force_on, - set_vintage=vintage) + virtual_migration = VirtualMigrator(config_file_name) + virtual_migration.run() + + migration = Migrator(config_file_name, force=force_on) + migration.run() + + if not migration.config_changed(): + os.remove(backup_file_name) else: - migration = VirtualMigrator(config_file_name, set_vintage=vintage) + virtual_migration = VirtualMigrator(config_file_name, + set_vintage=vintage) - migration.run() + virtual_migration.run() - if not migration._changed: - os.remove(backup_file_name) + if not virtual_migration.config_changed(): + os.remove(backup_file_name) if __name__ == '__main__': main() |