Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent exit code for 'podman rm' failures #2539

Closed
debarshiray opened this issue Mar 5, 2019 · 2 comments
Closed

Inconsistent exit code for 'podman rm' failures #2539

debarshiray opened this issue Mar 5, 2019 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@debarshiray
Copy link
Member

/kind bug

Description

When 'podman rm' is passed multiple containers and it's unable to remove one of them due to some reason, the exit code seems inconsistent across:

  • mentioning the containers individually on the command line, and
  • using --all

Describe the results you received:

Containers mentioned individually, and one of them doesn't exist:

$ podman rm fubar fedora-toolbox-rishi:28
unable to find container fubar: no container with name or ID fubar found: no such container
625532d6fa57af6cbfd5fcd304c0f5d1896dac9bf328852772236162a8c33949
$ echo $?
0

Using --all, and one of the containers is still running:

$ podman rm --all
65f4e61040462012f109cd1dfb9945761250242db5372a75cfd6d54efbb2f7d9
67c745518c90832c5fa22ad856b1c562111a7a5eadb3e7ad59538e7eb13723dc
9ee5efc7ea2a7d7fa7174132a10d4c6703bd869a0c5c3392906ff7fa249e8493
Error: cannot remove container a0a90116e7299f55f7dba43975610810e173bd99983a198fc17aa0231c8ccb52 as it is running - running or paused containers cannot be removed: container state improper
$ echo $?
125

Describe the results you expected:

I was expecting both cases to either return 0 or a non-zero value.

Output of podman version:

Version:            1.1.0
RemoteAPI Version:  1
Go Version:         go1.11.5
Git Commit:         902d0058ca196c24b1611546a6a7a6347972b827
Built:              Wed Feb 27 13:46:14 2019
OS/Arch:            linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  git commit: 902d0058ca196c24b1611546a6a7a6347972b827
  go version: go1.11.5
  podman version: 1.1.0
host:
  BuildahVersion: 1.7.1
  Conmon:
    package: podman-1.1.0-1.git006206a.fc29.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.12.0-dev, commit: 902d0058ca196c24b1611546a6a7a6347972b827'
  Distribution:
    distribution: fedora
    version: "29"
  MemFree: 840114176
  MemTotal: 8126992384
  OCIRuntime:
    package: runc-1.0.0-67.dev.git12f6a99.fc29.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc6+dev
      commit: d164d9b08bf7fc96a931403507dd16bced11b865
      spec: 1.0.1-dev
  SwapFree: 4127965184
  SwapTotal: 4133482496
  arch: amd64
  cpus: 4
  hostname: kolache
  kernel: 4.20.5-200.fc29.x86_64
  os: linux
  rootless: true
  uptime: 23h 4m 11.89s (Approximately 0.96 days)
insecure registries:
  registries: []
registries:
  registries:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /home/rishi/.config/containers/storage.conf
  ContainerStore:
    number: 1
  GraphDriverName: overlay
  GraphOptions:
  - overlay.mount_program=/usr/bin/fuse-overlayfs
  GraphRoot: /home/rishi/.local/share/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 7
  RunRoot: /run/user/1000
  VolumePath: /home/rishi/.local/share/containers/storage/volumes
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 5, 2019
@debarshiray
Copy link
Member Author

I was expecting both cases to either return 0 or a non-zero value.

Actually, podman-rm(1) says that 0 should only be returned if all the specified containers were removed.

giuseppe added a commit to giuseppe/libpod that referenced this issue Mar 5, 2019
Closes: containers#2539

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe
Copy link
Member

giuseppe commented Mar 5, 2019

@debarshiray: could you check if #2540 works for you?

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

3 participants