diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-12-09 08:46:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-09 08:46:44 -0500 |
commit | b875c5c27c503108f1984256833a9a2da4d0c5d1 (patch) | |
tree | 9c663f0c33849394373810b12f3db2974c3efaae /cmd/podman/utils/utils.go | |
parent | ae7f601649fd9d5e57ee0f6b0d35283bc4485259 (diff) | |
parent | a59e2a1a114c039e1780aa2b08b9452dc569cdf4 (diff) | |
download | podman-b875c5c27c503108f1984256833a9a2da4d0c5d1.tar.gz podman-b875c5c27c503108f1984256833a9a2da4d0c5d1.tar.bz2 podman-b875c5c27c503108f1984256833a9a2da4d0c5d1.zip |
Merge pull request #8599 from rhatdan/prune
Repeat system pruning until there is nothing removed
Diffstat (limited to 'cmd/podman/utils/utils.go')
-rw-r--r-- | cmd/podman/utils/utils.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/cmd/podman/utils/utils.go b/cmd/podman/utils/utils.go index 1c9e4d786..2ca2c4c92 100644 --- a/cmd/podman/utils/utils.go +++ b/cmd/podman/utils/utils.go @@ -26,8 +26,11 @@ func FileExists(path string) bool { return !file.IsDir() } -func PrintPodPruneResults(podPruneReports []*entities.PodPruneReport) error { +func PrintPodPruneResults(podPruneReports []*entities.PodPruneReport, heading bool) error { var errs OutputErrors + if heading && len(podPruneReports) > 0 { + fmt.Println("Deleted Pods") + } for _, r := range podPruneReports { if r.Err == nil { fmt.Println(r.Id) @@ -38,8 +41,11 @@ func PrintPodPruneResults(podPruneReports []*entities.PodPruneReport) error { return errs.PrintErrors() } -func PrintContainerPruneResults(containerPruneReport *entities.ContainerPruneReport) error { +func PrintContainerPruneResults(containerPruneReport *entities.ContainerPruneReport, heading bool) error { var errs OutputErrors + if heading && (len(containerPruneReport.ID) > 0 || len(containerPruneReport.Err) > 0) { + fmt.Println("Deleted Containers") + } for k := range containerPruneReport.ID { fmt.Println(k) } @@ -49,8 +55,11 @@ func PrintContainerPruneResults(containerPruneReport *entities.ContainerPruneRep return errs.PrintErrors() } -func PrintVolumePruneResults(volumePruneReport []*entities.VolumePruneReport) error { +func PrintVolumePruneResults(volumePruneReport []*entities.VolumePruneReport, heading bool) error { var errs OutputErrors + if heading && len(volumePruneReport) > 0 { + fmt.Println("Deleted Volumes") + } for _, r := range volumePruneReport { if r.Err == nil { fmt.Println(r.Id) @@ -61,7 +70,10 @@ func PrintVolumePruneResults(volumePruneReport []*entities.VolumePruneReport) er return errs.PrintErrors() } -func PrintImagePruneResults(imagePruneReport *entities.ImagePruneReport) error { +func PrintImagePruneResults(imagePruneReport *entities.ImagePruneReport, heading bool) error { + if heading && (len(imagePruneReport.Report.Id) > 0 || len(imagePruneReport.Report.Err) > 0) { + fmt.Println("Deleted Images") + } for _, i := range imagePruneReport.Report.Id { fmt.Println(i) } |