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

Merge branch '2.2' into 3.0

# Conflicts:
#	CHANGELOG
#	dev-requirements.txt
#	gns3server/compute/qemu/__init__.py
#	gns3server/compute/vmware/__init__.py
#	gns3server/controller/snapshot.py
#	gns3server/crash_report.py
#	gns3server/handlers/api/compute/atm_switch_handler.py
#	gns3server/run.py
#	gns3server/static/web-ui/26.77d4bfd104f37c42e028.js
#	gns3server/static/web-ui/index.html
#	gns3server/static/web-ui/runtime.415291667f70565cd8ef.js
#	gns3server/utils/__init__.py
#	gns3server/utils/images.py
#	gns3server/utils/interfaces.py
#	gns3server/version.py
#	gns3server/web/web_server.py
#	pytest.ini
#	requirements.txt
#	scripts/update-bundled-web-ui.sh
#	setup.py
#	tests/api/routes/compute/test_dynamips_nodes.py
#	tests/compute/builtin/nodes/test_cloud.py
#	tests/compute/docker/test_docker.py
#	tests/compute/docker/test_docker_vm.py
#	tests/compute/dynamips/test_dynamips_manager.py
#	tests/compute/dynamips/test_dynamips_router.py
#	tests/compute/iou/test_iou_vm.py
#	tests/compute/qemu/test_qcow2.py
#	tests/compute/qemu/test_qemu_manager.py
#	tests/compute/qemu/test_qemu_vm.py
#	tests/compute/test_base_node.py
#	tests/compute/test_manager.py
#	tests/compute/test_project.py
#	tests/compute/traceng/test_traceng_vm.py
#	tests/compute/virtualbox/test_virtualbox_manager.py
#	tests/compute/virtualbox/test_virtualbox_vm.py
#	tests/compute/vmware/test_vmware_manager.py
#	tests/compute/vmware/test_vmware_vm.py
#	tests/compute/vpcs/test_vpcs_vm.py
#	tests/conftest.py
#	tests/controller/gns3vm/test_remote_gns3_vm.py
#	tests/controller/gns3vm/test_virtualbox_gns3_vm.py
#	tests/controller/gns3vm/test_vmware_gns3_vm.py
#	tests/controller/test_export_project.py
#	tests/controller/test_gns3vm.py
#	tests/controller/test_import_project.py
#	tests/test_config.py
#	tests/utils/test_asyncio.py
#	tests/utils/test_images.py
#	tests/web/test_response.py
This commit is contained in:
grossmj 2024-05-16 17:53:39 +07:00
commit d3860ba84b
No known key found for this signature in database
GPG Key ID: 0A2D76AC45EA25CD
11 changed files with 46 additions and 25 deletions

View File

@ -1,5 +1,27 @@
# Change Log # Change Log
## 2.2.47 15/05/2024
* Fix update-bundled-web-ui.sh script
* Bundle web-ui v2.2.47
* Change sentry-sdk version
* Upgrade aiohttp, sentry-sdk and truststore
* Upgrade jsonschema and aiohttp
* Drop Python 3.7
* Remove dev requirements for Python 3.6
* Do not run Docker VM tests on Windows
* Do not wait for the server to close when shutting down.
* Fix test create image with not supported characters by filesystem. Fixes #2375
* Allow listing x86_64 IOU images. Fixes #2376
* Upgrade Jinja2 to version 3.1.4. Fixes #2378
* Fix link capture for ATM switch. Fixes https://github.com/GNS3/gns3-gui/issues/3570
* Fix tests after updating error message when busybox is not installed.
* Add more details to error message when busybox is not installed. Fixes https://github.com/GNS3/gns3-gui/issues/3569
* Fix invalid escape sequences
* Add NAT symbols
* Fix cannot stop Docker VM while console connection is still active.
* Upgrade sentry-sdk to version 1.40.6
## 3.0.0b2 07/04/2024 ## 3.0.0b2 07/04/2024
* Bundle web-ui v3.0.0b2 * Bundle web-ui v3.0.0b2

View File

@ -87,7 +87,7 @@ class Docker(BaseManager):
f"{stdout.decode('utf-8', errors='ignore').strip()}") f"{stdout.decode('utf-8', errors='ignore').strip()}")
except OSError as e: except OSError as e:
raise DockerError(f"Could not install busybox: {e}") raise DockerError(f"Could not install busybox: {e}")
raise DockerError("No busybox executable could be found") raise DockerError("No busybox executable could be found, please install busybox (apt install busybox-static on Debian/Ubuntu) and make sure it is in your PATH")
@staticmethod @staticmethod
def resources_path(): def resources_path():

View File

@ -51,11 +51,11 @@ class Snapshot:
self._project = project self._project = project
if name: if name:
self._name = name self._name = name
self._created_at = datetime.now().timestamp() self._created_at = datetime.now(timezone.utc).timestamp()
filename = ( filename = (
self._name self._name
+ "_" + "_"
+ datetime.utcfromtimestamp(self._created_at).replace(tzinfo=None).strftime("%d%m%y_%H%M%S") + datetime.fromtimestamp(self._created_at, tz=timezone.utc).replace(tzinfo=None).strftime("%d%m%y_%H%M%S")
+ ".gns3project" + ".gns3project"
) )
else: else:
@ -66,7 +66,7 @@ class Snapshot:
datetime.strptime(datestring, "%d%m%y_%H%M%S").replace(tzinfo=timezone.utc).timestamp() datetime.strptime(datestring, "%d%m%y_%H%M%S").replace(tzinfo=timezone.utc).timestamp()
) )
except ValueError: except ValueError:
self._created_at = datetime.utcnow().timestamp() self._created_at = datetime.now(timezone.utc)
self._path = os.path.join(project.path, "snapshots", filename) self._path = os.path.join(project.path, "snapshots", filename)
@property @property

View File

@ -213,7 +213,7 @@ class UDPLink(Link):
:returns: Node where the capture should run :returns: Node where the capture should run
""" """
ALWAYS_RUNNING_NODES_TYPE = ("cloud", "nat", "ethernet_switch", "ethernet_hub") ALWAYS_RUNNING_NODES_TYPE = ("cloud", "nat", "ethernet_switch", "ethernet_hub", "frame_relay_switch", "atm_switch")
for node in self._nodes: for node in self._nodes:
if ( if (

File diff suppressed because one or more lines are too long

View File

@ -83,11 +83,9 @@ async def list_images(image_type):
with open(os.path.join(root, filename), "rb") as f: with open(os.path.join(root, filename), "rb") as f:
# read the first 7 bytes of the file. # read the first 7 bytes of the file.
elf_header_start = f.read(7) elf_header_start = f.read(7)
# valid IOS images must start with the ELF magic number, be 32-bit, big endian and have an ELF version of 1 # valid IOU or IOS images must start with the ELF magic number, be 32-bit or 64-bit,
if ( # little endian and have an ELF version of 1
not elf_header_start == b"\x7fELF\x01\x02\x01" if elf_header_start != b'\x7fELF\x02\x01\x01' and elf_header_start != b'\x7fELF\x01\x01\x01':
and not elf_header_start == b"\x7fELF\x01\x01\x01"
):
continue continue
images.append( images.append(

View File

@ -5,8 +5,8 @@ websockets==12.0
aiohttp==3.9.3 aiohttp==3.9.3
async-timeout==4.0.3 async-timeout==4.0.3
aiofiles==23.2.1 aiofiles==23.2.1
Jinja2>=3.1.3,<3.2 Jinja2>=3.1.4,<3.2
sentry-sdk==1.40.6,<1.41 sentry-sdk==2.1.1,<2.2
psutil==5.9.8 psutil==5.9.8
distro>=1.9.0 distro>=1.9.0
py-cpuinfo==9.0.0 py-cpuinfo==9.0.0
@ -20,4 +20,4 @@ watchfiles==0.21.0
zstandard==0.22.0 zstandard==0.22.0
platformdirs==4.2.1 platformdirs==4.2.1
importlib-resources>=1.3; python_version <= '3.9' importlib-resources>=1.3; python_version <= '3.9'
truststore>=0.8.0; python_version >= '3.10' truststore>=0.9.1; python_version >= '3.10'

View File

@ -146,7 +146,7 @@ def fake_image(tmpdir) -> str:
path = str(tmpdir / "7200.bin") path = str(tmpdir / "7200.bin")
with open(path, "wb+") as f: with open(path, "wb+") as f:
f.write(b'\x7fELF\x01\x02\x01') f.write(b'\x7fELF\x01\x01\x01')
os.chmod(path, stat.S_IREAD) os.chmod(path, stat.S_IREAD)
return path return path
@ -170,7 +170,7 @@ async def test_images(app: FastAPI, compute_client: AsyncClient, tmpdir, fake_im
assert response.json() == [{"filename": "7200.bin", assert response.json() == [{"filename": "7200.bin",
"path": "7200.bin", "path": "7200.bin",
"filesize": 7, "filesize": 7,
"md5sum": "b0d5aa897d937aced5a6b1046e8f7e2e"}] "md5sum": "e573e8f5c93c6c00783f20c7a170aa6c"}]
async def test_upload_image(app: FastAPI, compute_client: AsyncClient, images_dir: str) -> None: async def test_upload_image(app: FastAPI, compute_client: AsyncClient, images_dir: str) -> None:

View File

@ -247,7 +247,7 @@ async def test_install_busybox_dynamic_linked():
with pytest.raises(DockerError) as e: with pytest.raises(DockerError) as e:
dst_dir = Docker.resources_path() dst_dir = Docker.resources_path()
await Docker.install_busybox(dst_dir) await Docker.install_busybox(dst_dir)
assert str(e.value) == "No busybox executable could be found" assert str(e.value) == "No busybox executable could be found, please install busybox (apt install busybox-static on Debian/Ubuntu) and make sure it is in your PATH"
@pytest.mark.asyncio @pytest.mark.asyncio
@ -258,4 +258,4 @@ async def test_install_busybox_no_executables():
with pytest.raises(DockerError) as e: with pytest.raises(DockerError) as e:
dst_dir = Docker.resources_path() dst_dir = Docker.resources_path()
await Docker.install_busybox(dst_dir) await Docker.install_busybox(dst_dir)
assert str(e.value) == "No busybox executable could be found" assert str(e.value) == "No busybox executable could be found, please install busybox (apt install busybox-static on Debian/Ubuntu) and make sure it is in your PATH"

View File

@ -105,5 +105,5 @@ class AsyncioBytesIO(io.BytesIO):
async def write(self, data): async def write(self, data):
return super().write(data) return super().write(data)
async def close(self): # async def close(self):
return super().close() # return super().close()

View File

@ -115,11 +115,11 @@ def test_remove_checksum(tmpdir):
async def test_list_images(tmpdir, config): async def test_list_images(tmpdir, config):
path1 = tmpdir / "images1" / "IOS" / "test1.image" path1 = tmpdir / "images1" / "IOS" / "test1.image"
path1.write(b'\x7fELF\x01\x02\x01', ensure=True) path1.write(b'\x7fELF\x01\x01\x01', ensure=True)
path1 = force_unix_path(str(path1)) path1 = force_unix_path(str(path1))
path2 = tmpdir / "images2" / "test2.image" path2 = tmpdir / "images2" / "test2.image"
path2.write(b'\x7fELF\x01\x02\x01', ensure=True) path2.write(b'\x7fELF\x01\x01\x01', ensure=True)
path2 = force_unix_path(str(path2)) path2 = force_unix_path(str(path2))
# Invalid image because not a valid elf file # Invalid image because not a valid elf file
@ -128,7 +128,7 @@ async def test_list_images(tmpdir, config):
if sys.platform.startswith("linux"): if sys.platform.startswith("linux"):
path3 = tmpdir / "images1" / "IOU" / "test3.bin" path3 = tmpdir / "images1" / "IOU" / "test3.bin"
path3.write(b'\x7fELF\x01\x02\x01', ensure=True) path3.write(b'\x7fELF\x02\x01\x01', ensure=True)
path3 = force_unix_path(str(path3)) path3 = force_unix_path(str(path3))
path4 = tmpdir / "images1" / "QEMU" / "test4.qcow2" path4 = tmpdir / "images1" / "QEMU" / "test4.qcow2"
@ -146,13 +146,13 @@ async def test_list_images(tmpdir, config):
{ {
'filename': 'test1.image', 'filename': 'test1.image',
'filesize': 7, 'filesize': 7,
'md5sum': 'b0d5aa897d937aced5a6b1046e8f7e2e', 'md5sum': 'e573e8f5c93c6c00783f20c7a170aa6c',
'path': 'test1.image' 'path': 'test1.image'
}, },
{ {
'filename': 'test2.image', 'filename': 'test2.image',
'filesize': 7, 'filesize': 7,
'md5sum': 'b0d5aa897d937aced5a6b1046e8f7e2e', 'md5sum': 'e573e8f5c93c6c00783f20c7a170aa6c',
'path': str(path2) 'path': str(path2)
} }
] ]
@ -162,7 +162,7 @@ async def test_list_images(tmpdir, config):
{ {
'filename': 'test3.bin', 'filename': 'test3.bin',
'filesize': 7, 'filesize': 7,
'md5sum': 'b0d5aa897d937aced5a6b1046e8f7e2e', 'md5sum': 'c73626d23469519894d58bc98bee9655',
'path': 'test3.bin' 'path': 'test3.bin'
} }
] ]