1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Fix templates missing after server restart. Fixes https://github.com/GNS3/gns3-gui/issues/2769

This commit is contained in:
grossmj 2019-04-14 20:39:55 +07:00
parent e962717448
commit 6dbb992513
2 changed files with 6 additions and 4 deletions

View File

@ -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)
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))

View File

@ -128,6 +128,7 @@ class Controller:
except (ComputeError, aiohttp.web.HTTPError, OSError):
pass
await self.gns3vm.exit_vm()
self.save()
self._computes = {}
self._projects = {}