diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-05 17:25:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-05 17:25:04 +0200 |
commit | e6235ef8f1a3111f8f1afbb1bf64f0e6da704a5b (patch) | |
tree | 0e9adb10b78b589120b81b49c46b41cc75da7966 /cmd/podman | |
parent | 4a1331d0afd9a21ff9465916d4006ff7297ae07c (diff) | |
parent | 7f97896c59d23d9dda704b19203a9ceb49b57237 (diff) | |
download | podman-e6235ef8f1a3111f8f1afbb1bf64f0e6da704a5b.tar.gz podman-e6235ef8f1a3111f8f1afbb1bf64f0e6da704a5b.tar.bz2 podman-e6235ef8f1a3111f8f1afbb1bf64f0e6da704a5b.zip |
Merge pull request #6076 from vrothberg/rmi-v2.2
image removal: refactor part 2
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/containers/run.go | 6 | ||||
-rw-r--r-- | cmd/podman/images/rm.go | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go index b13983e37..f72446cb6 100644 --- a/cmd/podman/containers/run.go +++ b/cmd/podman/containers/run.go @@ -170,9 +170,9 @@ func run(cmd *cobra.Command, args []string) error { return nil } if runRmi { - _, err := registry.ImageEngine().Remove(registry.GetContext(), []string{args[0]}, entities.ImageRemoveOptions{}) - if err != nil { - logrus.Errorf("%s", errors.Wrapf(err, "failed removing image")) + _, rmErrors := registry.ImageEngine().Remove(registry.GetContext(), []string{args[0]}, entities.ImageRemoveOptions{}) + if len(rmErrors) > 0 { + logrus.Errorf("%s", errors.Wrapf(errorhandling.JoinErrors(rmErrors), "failed removing image")) } } return nil diff --git a/cmd/podman/images/rm.go b/cmd/podman/images/rm.go index 1cf5fa365..4b9920532 100644 --- a/cmd/podman/images/rm.go +++ b/cmd/podman/images/rm.go @@ -5,6 +5,7 @@ import ( "github.com/containers/libpod/cmd/podman/registry" "github.com/containers/libpod/pkg/domain/entities" + "github.com/containers/libpod/pkg/errorhandling" "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -48,7 +49,9 @@ func rm(cmd *cobra.Command, args []string) error { return errors.Errorf("when using the --all switch, you may not pass any images names or IDs") } - report, err := registry.ImageEngine().Remove(registry.GetContext(), args, imageOpts) + // Note: certain image-removal errors are non-fatal. Hence, the report + // might be set even if err != nil. + report, rmErrors := registry.ImageEngine().Remove(registry.GetContext(), args, imageOpts) if report != nil { for _, u := range report.Untagged { fmt.Println("Untagged: " + u) @@ -62,5 +65,5 @@ func rm(cmd *cobra.Command, args []string) error { registry.SetExitCode(report.ExitCode) } - return err + return errorhandling.JoinErrors(rmErrors) } |