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

Confirmation prompt for 'container prune' breaks non-interactive use #4844

Closed
StefanBruens opened this issue Jan 11, 2020 · 4 comments · Fixed by #4845
Closed

Confirmation prompt for 'container prune' breaks non-interactive use #4844

StefanBruens opened this issue Jan 11, 2020 · 4 comments · Fixed by #4845
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

@StefanBruens
Copy link

StefanBruens commented Jan 11, 2020

/kind bug

Description

With podman 1.7.0, it is no longer possible to prune containers from a script.

The prompt can be avoided by adding --force, but this will also prune running containers.

Please add a --yes/-y flag to allow confirmation from a script.

The prompt was added here:
0602ce4

Steps to reproduce the issue:

podman container prune && echo "OK"

Describe the results you received:

WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N]

Describe the results you expected:

OK

Output of podman version:

1.7.0

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 11, 2020
@mheon
Copy link
Member

mheon commented Jan 11, 2020 via email

@StefanBruens
Copy link
Author

@mheon
Copy link
Member

mheon commented Jan 11, 2020

It's possible the description there may be inaccurate. prune --force should only remove stopped containers, but with no prompt. I need to verify if this is actually the case.

@baude
Copy link
Member

baude commented Jan 12, 2020

@mheon @StefanBruens this just tripped me up as well while i was working on the apiv2 stuff so i had to look at the code as well. it turns out the description is incorrect. the force should only be used to skip the interactive bit. however, it IS passed onto the container removal call. that said, we are safe here because prune uses container filters to select which containers to prune. therefore the force is basically a no-op. i'll see about a quick pr to tidy this up.

baude added a commit to baude/podman that referenced this issue Jan 12, 2020
ainer prune --force

the --force parameter should only be used for the CLI and should only
dictate whether to prompt the user for confirmation.

Fixes: containers#4844
Signed-off-by: baude <bbaude@redhat.com>
@baude baude mentioned this issue Jan 12, 2020
baude added a commit to baude/podman that referenced this issue Jan 12, 2020
ainer prune --force

the --force parameter should only be used for the CLI and should only
dictate whether to prompt the user for confirmation.

Fixes: containers#4844
Signed-off-by: baude <bbaude@redhat.com>
baude added a commit to baude/podman that referenced this issue Jan 13, 2020
the --force parameter should only be used for the CLI and should only
dictate whether to prompt the user for confirmation.

Fixes: containers#4844
Signed-off-by: baude <bbaude@redhat.com>
@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 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 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

Successfully merging a pull request may close this issue.

4 participants