Merge branch '2.2' into 3.0

# Conflicts:
#	.github/workflows/testing.yml
#	CHANGELOG
#	README.md
#	dev-requirements.txt
#	gns3server/compute/docker/docker_vm.py
#	gns3server/controller/export_project.py
#	gns3server/controller/import_project.py
#	gns3server/controller/project.py
#	gns3server/crash_report.py
#	gns3server/static/web-ui/index.html
#	gns3server/static/web-ui/main.df8c319a3da6fb0e3629.js
#	gns3server/version.py
#	requirements.txt
#	setup.py
#	tests/compute/docker/test_docker_vm.py
#	tests/controller/test_import_project.py
This commit is contained in:
grossmj committed 2024-10-31 12:54:35 +10:00
commit c4fcb43e78
24 files changed
+648 -312

No files matched your search

+17 -14
View File
@@ -89,14 +89,15 @@ async def export_project(
files = [f for f in files if _is_exportable(os.path.join(root, f), include_snapshots)]
for file in files:
path = os.path.join(root, file)
# check if we can export the file
try:
open(path).close()
except OSError as e:
msg = f"Could not export file {path}: {e}"
log.warning(msg)
project.emit_notification("log.warning", {"message": msg})
continue
if not os.path.islink(path):
try:
# check if we can export the file
open(path).close()
except OSError as e:
msg = f"Could not export file {path}: {e}"
log.warning(msg)
project.emit_notification("log.warning", {"message": msg})
continue
# ignore the .gns3 file
if file.endswith(".gns3"):
continue
@@ -150,7 +151,10 @@ def _patch_mtime(path):
:param path: file path
"""
st = os.stat(path)
if sys.platform.startswith("win"):
# only UNIX type platforms
return
st = os.stat(path, follow_symlinks=False)
file_date = datetime.fromtimestamp(st.st_mtime)
if file_date.year < 1980:
new_mtime = file_date.replace(year=1980).timestamp()
@@ -166,10 +170,6 @@ def _is_exportable(path, include_snapshots=False):
if include_snapshots is False and path.endswith("snapshots"):
return False
# do not export symlinks
if os.path.islink(path):
return False
# do not export directories of snapshots
if include_snapshots is False and "{sep}snapshots{sep}".format(sep=os.path.sep) in path:
return False
@@ -228,13 +228,16 @@ async def _patch_project_file(
if not keep_compute_ids:
node["compute_id"] = "local" # To make project portable all node by default run on local
if "properties" in node and node["node_type"] != "docker":
if "properties" in node:
for prop, value in node["properties"].items():
# reset the MAC address
if reset_mac_addresses and prop in ("mac_addr", "mac_address"):
node["properties"][prop] = None
if node["node_type"] == "docker":
continue
if node["node_type"] == "iou":
if not prop == "path":
continue