diff --git a/gns3server/config.py b/gns3server/config.py index a0c2d8d5..2ada115f 100644 --- a/gns3server/config.py +++ b/gns3server/config.py @@ -131,14 +131,15 @@ class Config: try: # migrate the server config file old_server_config = os.path.join(legacy_user_dir, server_filename) - if os.path.exists(old_server_config): - new_server_config = os.path.join(versioned_user_dir, server_filename) + new_server_config = os.path.join(versioned_user_dir, server_filename) + if not os.path.exists(new_server_config) and os.path.exists(old_server_config): shutil.copyfile(old_server_config, new_server_config) # migrate the controller config file old_controller_config = os.path.join(legacy_user_dir, controller_filename) - if os.path.exists(old_controller_config): - shutil.copyfile(old_controller_config, os.path.join(versioned_user_dir, controller_filename)) + new_controller_config = os.path.join(versioned_user_dir, controller_filename) + if not os.path.exists(new_controller_config) and os.path.exists(old_controller_config): + shutil.copyfile(old_controller_config, os.path.join(versioned_user_dir, new_controller_config)) except OSError as e: log.error("Cannot migrate old config files: {}".format(e)) diff --git a/gns3server/controller/__init__.py b/gns3server/controller/__init__.py index 445fdaad..d546f9b3 100644 --- a/gns3server/controller/__init__.py +++ b/gns3server/controller/__init__.py @@ -128,6 +128,7 @@ class Controller: except (ComputeError, aiohttp.web.HTTPError, OSError): pass await self.gns3vm.exit_vm() + self.save() self._computes = {} self._projects = {}