mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-21 21:45:20 +02:00
feat: name nodes and templates in Docker image delete conflicts
The compute translates the container ids in a daemon delete conflict into the GNS3 node and project behind each container. Leftover containers from closed projects and containers created outside GNS3 are named as such. The controller lists the templates referencing the image in the conflict error, matched through the canonical image name. After a successful deletion it emits a docker.image.deleted notification with those templates: their nodes can no longer start.
This commit is contained in:
6 files changed
+341
-7
No files matched your search
@@ -20,7 +20,13 @@ import threading
|
||||
import pytest
|
||||
|
||||
from gns3server.utils import force_unix_path
|
||||
from gns3server.utils.images import images_directories, list_images, md5sum, remove_checksum
|
||||
from gns3server.utils.images import (
|
||||
canonical_docker_image_name,
|
||||
images_directories,
|
||||
list_images,
|
||||
md5sum,
|
||||
remove_checksum,
|
||||
)
|
||||
|
||||
|
||||
def test_images_directories(tmpdir, config):
|
||||
@@ -108,6 +114,29 @@ def test_remove_checksum(tmpdir):
|
||||
remove_checksum(str(tmpdir / "not_exists"))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"reference, expected",
|
||||
(
|
||||
("alpine", "library/alpine:latest"),
|
||||
("alpine:3", "library/alpine:3"),
|
||||
("library/alpine:3", "library/alpine:3"),
|
||||
("docker.io/library/alpine:3", "library/alpine:3"),
|
||||
("index.docker.io/library/alpine:3", "library/alpine:3"),
|
||||
("localhost/alpine:3", "library/alpine:3"),
|
||||
("gns3/frr", "gns3/frr:latest"),
|
||||
("gns3/frr:latest", "gns3/frr:latest"),
|
||||
("quay.io/some/namespace/image:2.0", "some/namespace/image:2.0"),
|
||||
("alpine@sha256:" + "a" * 64, "library/alpine@sha256:" + "a" * 64),
|
||||
("alpine:3@sha256:" + "a" * 64, "library/alpine@sha256:" + "a" * 64),
|
||||
),
|
||||
)
|
||||
def test_canonical_docker_image_name(reference, expected):
|
||||
|
||||
assert canonical_docker_image_name(reference) == expected
|
||||
# the canonical form is stable: canonicalizing twice does not change it
|
||||
assert canonical_docker_image_name(expected) == expected
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_images(tmpdir, config):
|
||||
|
||||
|
||||
Reference in new issue
Block a user