mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-24 15:58:08 +00:00
Delete the built-in appliance directory before installing updated files
This commit is contained in:
parent
5bccf4841d
commit
d2ad9dc5e2
@ -318,7 +318,6 @@ class Controller:
|
|||||||
|
|
||||||
server_config = Config.instance().get_section_config("Server")
|
server_config = Config.instance().get_section_config("Server")
|
||||||
configs_path = os.path.expanduser(server_config.get("configs_path", "~/GNS3/configs"))
|
configs_path = os.path.expanduser(server_config.get("configs_path", "~/GNS3/configs"))
|
||||||
# shutil.rmtree(configs_path, ignore_errors=True)
|
|
||||||
os.makedirs(configs_path, exist_ok=True)
|
os.makedirs(configs_path, exist_ok=True)
|
||||||
return configs_path
|
return configs_path
|
||||||
|
|
||||||
|
@ -81,14 +81,15 @@ class ApplianceManager:
|
|||||||
os.makedirs(appliances_path, exist_ok=True)
|
os.makedirs(appliances_path, exist_ok=True)
|
||||||
return appliances_path
|
return appliances_path
|
||||||
|
|
||||||
def _builtin_appliances_path(self):
|
def _builtin_appliances_path(self, delete_first=False):
|
||||||
"""
|
"""
|
||||||
Get the built-in appliance storage directory
|
Get the built-in appliance storage directory
|
||||||
"""
|
"""
|
||||||
|
|
||||||
config = Config.instance()
|
config = Config.instance()
|
||||||
appliances_dir = os.path.join(config.config_dir, "appliances")
|
appliances_dir = os.path.join(config.config_dir, "appliances")
|
||||||
# shutil.rmtree(appliances_dir, ignore_errors=True)
|
if delete_first:
|
||||||
|
shutil.rmtree(appliances_dir, ignore_errors=True)
|
||||||
os.makedirs(appliances_dir, exist_ok=True)
|
os.makedirs(appliances_dir, exist_ok=True)
|
||||||
return appliances_dir
|
return appliances_dir
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ class ApplianceManager:
|
|||||||
At startup we copy the built-in appliances files.
|
At startup we copy the built-in appliances files.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
dst_path = self._builtin_appliances_path()
|
dst_path = self._builtin_appliances_path(delete_first=True)
|
||||||
log.info(f"Installing built-in appliances in '{dst_path}'")
|
log.info(f"Installing built-in appliances in '{dst_path}'")
|
||||||
try:
|
try:
|
||||||
if hasattr(sys, "frozen") and sys.platform.startswith("win"):
|
if hasattr(sys, "frozen") and sys.platform.startswith("win"):
|
||||||
|
Loading…
Reference in New Issue
Block a user