summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-06-20 13:57:42 +0000
committerGitHub <noreply@github.com>2022-06-20 13:57:42 +0000
commitfe8e536328eef61f0cf7ffd42b74d4e5be4654ee (patch)
tree52f56b0a427d04313a363ab71f883a85b7b83faf /cmd/podman
parent55052c6b9807b5a51b50abc90e391e872be450c2 (diff)
parent4811cb110accec51df168742df6a319f48ed37b6 (diff)
downloadpodman-fe8e536328eef61f0cf7ffd42b74d4e5be4654ee.tar.gz
podman-fe8e536328eef61f0cf7ffd42b74d4e5be4654ee.tar.bz2
podman-fe8e536328eef61f0cf7ffd42b74d4e5be4654ee.zip
Merge pull request #14556 from sstosh/system-prune-network
podman system prune support prune unused networks
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/system/prune.go6
-rw-r--r--cmd/podman/utils/utils.go15
2 files changed, 21 insertions, 0 deletions
diff --git a/cmd/podman/system/prune.go b/cmd/podman/system/prune.go
index ff78f93bb..1d6ba8155 100644
--- a/cmd/podman/system/prune.go
+++ b/cmd/podman/system/prune.go
@@ -75,6 +75,7 @@ func prune(cmd *cobra.Command, args []string) error {
}
}
+ // Remove all unused pods, containers, images, networks, and volume data.
pruneOptions.Filters, err = parse.FilterArgumentsIntoFilters(filters)
if err != nil {
return err
@@ -106,6 +107,11 @@ func prune(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
+ // Print Network prune results
+ err = utils.PrintNetworkPruneResults(response.NetworkPruneReports, true)
+ if err != nil {
+ return err
+ }
fmt.Printf("Total reclaimed space: %s\n", units.HumanSize((float64)(response.ReclaimedSpace)))
return nil
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()
+}