From 4811cb110accec51df168742df6a319f48ed37b6 Mon Sep 17 00:00:00 2001 From: Toshiki Sonoda Date: Tue, 14 Jun 2022 14:04:03 +0900 Subject: podman system prune support prune unused networks This is an enhancement for the podman system prune feature. In this issue, it is mentioned that 'network prune' should be wired into 'podman system prune' https://github.com/containers/podman/issues/8673 Therefore, I add the function to remove unused networks. Signed-off-by: Toshiki Sonoda --- cmd/podman/utils/utils.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'cmd/podman/utils') diff --git a/cmd/podman/utils/utils.go b/cmd/podman/utils/utils.go index 6fd6647d0..73bb34983 100644 --- a/cmd/podman/utils/utils.go +++ b/cmd/podman/utils/utils.go @@ -84,3 +84,18 @@ func PrintImagePruneResults(imagePruneReports []*reports.PruneReport, heading bo return nil } + +func PrintNetworkPruneResults(networkPruneReport []*reports.PruneReport, heading bool) error { + var errs OutputErrors + if heading && len(networkPruneReport) > 0 { + fmt.Println("Deleted Networks") + } + for _, r := range networkPruneReport { + if r.Err == nil { + fmt.Println(r.Id) + } else { + errs = append(errs, r.Err) + } + } + return errs.PrintErrors() +} -- cgit v1.2.3-54-g00ecf