Show live progress while pruning networks, and ask first (0.63.0)
The network prune joins the image and volume prunes on the shared
PruneJob: it runs in the background, the Networks page shows a progress
bar and a toast with the outcome, and the button now asks before deleting
instead of pruning on click. Docker has no -a for networks and they hold
no data, so there is no option and no space figure.
Candidates are stricter than docker network prune, which goes by active
endpoints and so removes a stopped container's network, after which that
container fails to start ("network not found"). A network any container,
running or stopped, is attached to (by name or id) is kept, as are
bridge/host/none, ingress/docker_gwbridge and swarm-scoped networks.
Removal is per network, so one the daemon refuses does not stop the rest.
- POST /api/networks/prune takes background=; without it it still waits
and returns {NetworksDeleted}. GET /api/networks/prune-status is
admin-only and registered before /{network_id}, which would otherwise
take "prune-status" for an id.
- The long-timeout test for network prune in test_docker_timeouts.py is
superseded by test_network_prune.py.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
57231e4a67
commit
ee98d0da6d
12 files changed
+293
-61
No files matched your search
@@ -50,35 +50,6 @@ def test_volume_prune_timeout_is_a_502_with_detail(as_admin, monkeypatch):
|
||||
assert r.json()["error"] == "docker_timeout"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"module, fn, args",
|
||||
[
|
||||
("network_service", "prune_networks", ()),
|
||||
],
|
||||
)
|
||||
def test_prunes_use_the_long_timeout_client(monkeypatch, module, fn, args):
|
||||
import importlib
|
||||
|
||||
svc = importlib.import_module(f"services.{module}")
|
||||
used = []
|
||||
|
||||
class Any_:
|
||||
def prune(self, filters=None):
|
||||
used.append("long")
|
||||
return {}
|
||||
|
||||
class Client:
|
||||
volumes = images = networks = Any_()
|
||||
|
||||
def short():
|
||||
raise AssertionError("prune must not use the 60s client")
|
||||
|
||||
monkeypatch.setattr(svc, "get_client", short)
|
||||
monkeypatch.setattr(svc, "get_long_client", lambda: Client())
|
||||
getattr(svc, fn)(*args)
|
||||
assert used == ["long"]
|
||||
|
||||
|
||||
# The image and volume prunes go item by item and have their own tests in
|
||||
# test_image_prune.py / test_volume_prune.py, including that they use the
|
||||
# long-timeout client.
|
||||
# The image, volume and network prunes go item by item and have their own
|
||||
# tests (test_image_prune.py, test_volume_prune.py, test_network_prune.py),
|
||||
# including that they use the long-timeout client.
|
||||
Reference in new issue
Block a user