summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2022-05-25 09:05:50 -0700
committerJhon Honce <jhonce@redhat.com>2022-05-25 11:14:20 -0700
commit66c846616c2b77d85ec32ed730897be510b808fa (patch)
treecb2ba05fac40caaa1c0b4af2665e39e72dc76128 /cmd/podman
parente26ad5066981a50053c5a9e157c6e5ce6c1c609b (diff)
downloadpodman-66c846616c2b77d85ec32ed730897be510b808fa.tar.gz
podman-66c846616c2b77d85ec32ed730897be510b808fa.tar.bz2
podman-66c846616c2b77d85ec32ed730897be510b808fa.zip
Support remote deadlock errors in rm
Refactor test for deadlock by comparing error text vs. actual ErrWillDeadlock constant. When running with --remote the error constant will always be not equal to the error returned by the API. ```release-note NONE ``` [NO NEW TESTS NEEDED] Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/containers/rm.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/cmd/podman/containers/rm.go b/cmd/podman/containers/rm.go
index 420e3c38d..62143bbec 100644
--- a/cmd/podman/containers/rm.go
+++ b/cmd/podman/containers/rm.go
@@ -123,9 +123,7 @@ func rm(cmd *cobra.Command, args []string) error {
// removeContainers will set the exit code according to the `podman-rm` man
// page.
func removeContainers(namesOrIDs []string, rmOptions entities.RmOptions, setExit bool) error {
- var (
- errs utils.OutputErrors
- )
+ var errs utils.OutputErrors
responses, err := registry.ContainerEngine().ContainerRm(context.Background(), namesOrIDs, rmOptions)
if err != nil {
if setExit {
@@ -135,8 +133,9 @@ func removeContainers(namesOrIDs []string, rmOptions entities.RmOptions, setExit
}
for _, r := range responses {
if r.Err != nil {
- // TODO this will not work with the remote client
- if errors.Cause(err) == define.ErrWillDeadlock {
+ // When using the API, errors.Cause(err) will never equal constant define.ErrWillDeadLock
+ if errors.Cause(r.Err) == define.ErrWillDeadlock ||
+ errors.Cause(r.Err).Error() == define.ErrWillDeadlock.Error() {
logrus.Errorf("Potential deadlock detected - please run 'podman system renumber' to resolve")
}
if setExit {