Skip to content

Commit

Permalink
Fix templates missing after server restart. Fixes GNS3/gns3-gui#2769
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Apr 14, 2019
1 parent e962717 commit 6dbb992
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gns3server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,15 @@ def __init__(self, files=None, profile=None):
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))

Expand Down
1 change: 1 addition & 0 deletions gns3server/controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ async def stop(self):
except (ComputeError, aiohttp.web.HTTPError, OSError):
pass
await self.gns3vm.exit_vm()
self.save()
self._computes = {}
self._projects = {}

Expand Down

0 comments on commit 6dbb992

Please sign in to comment.