mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-25 01:38:08 +00:00
Fix templates missing after server restart. Fixes https://github.com/GNS3/gns3-gui/issues/2769
This commit is contained in:
parent
e962717448
commit
6dbb992513
@ -131,14 +131,15 @@ class Config:
|
|||||||
try:
|
try:
|
||||||
# migrate the server config file
|
# migrate the server config file
|
||||||
old_server_config = os.path.join(legacy_user_dir, server_filename)
|
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)
|
shutil.copyfile(old_server_config, new_server_config)
|
||||||
|
|
||||||
# migrate the controller config file
|
# migrate the controller config file
|
||||||
old_controller_config = os.path.join(legacy_user_dir, controller_filename)
|
old_controller_config = os.path.join(legacy_user_dir, controller_filename)
|
||||||
if os.path.exists(old_controller_config):
|
new_controller_config = os.path.join(versioned_user_dir, controller_filename)
|
||||||
shutil.copyfile(old_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:
|
except OSError as e:
|
||||||
log.error("Cannot migrate old config files: {}".format(e))
|
log.error("Cannot migrate old config files: {}".format(e))
|
||||||
|
|
||||||
|
@ -128,6 +128,7 @@ class Controller:
|
|||||||
except (ComputeError, aiohttp.web.HTTPError, OSError):
|
except (ComputeError, aiohttp.web.HTTPError, OSError):
|
||||||
pass
|
pass
|
||||||
await self.gns3vm.exit_vm()
|
await self.gns3vm.exit_vm()
|
||||||
|
self.save()
|
||||||
self._computes = {}
|
self._computes = {}
|
||||||
self._projects = {}
|
self._projects = {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user