diff options
author | baude <bbaude@redhat.com> | 2019-07-08 13:20:17 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-07-10 15:52:17 -0500 |
commit | e053e0e05ecd884067125627f0006d1b6e19226e (patch) | |
tree | 9e5bcca7703a041b23c2e3c9fcfe928e8bca2962 /cmd/podman/system_prune.go | |
parent | 81e722d08617ee19235bf57de6d86124e6b4574a (diff) | |
download | podman-e053e0e05ecd884067125627f0006d1b6e19226e.tar.gz podman-e053e0e05ecd884067125627f0006d1b6e19226e.tar.bz2 podman-e053e0e05ecd884067125627f0006d1b6e19226e.zip |
first pass of corrections for golangci-lint
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/system_prune.go')
-rw-r--r-- | cmd/podman/system_prune.go | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/cmd/podman/system_prune.go b/cmd/podman/system_prune.go index d5b218cd8..b499d8dd2 100644 --- a/cmd/podman/system_prune.go +++ b/cmd/podman/system_prune.go @@ -76,27 +76,33 @@ Are you sure you want to continue? [y/N] `, volumeString) if err != nil { return errors.Wrapf(err, "could not get runtime") } - defer runtime.Shutdown(false) - - rmWorkers := shared.Parallelize("rm") - ctx := getContext() - fmt.Println("Deleted Containers") - ok, failures, lasterr := runtime.Prune(ctx, rmWorkers, false) - printCmdResults(ok, failures) + defer runtime.DeferredShutdown(false) + // We must clean out pods first because if they may have infra containers fmt.Println("Deleted Pods") pruneValues := cliconfig.PodPruneValues{ PodmanCommand: c.PodmanCommand, Force: c.Force, } - ok, failures, err = runtime.PrunePods(ctx, &pruneValues) + ctx := getContext() + ok, failures, lasterr := runtime.PrunePods(ctx, &pruneValues) + + if err := printCmdResults(ok, failures); err != nil { + return err + } + + rmWorkers := shared.Parallelize("rm") + fmt.Println("Deleted Containers") + ok, failures, err = runtime.Prune(ctx, rmWorkers, false) if err != nil { if lasterr != nil { - logrus.Errorf("%q", lasterr) + logrus.Errorf("%q", err) } lasterr = err } - printCmdResults(ok, failures) + if err := printCmdResults(ok, failures); err != nil { + return err + } if c.Bool("volumes") { fmt.Println("Deleted Volumes") |