Skip to content

Commit

Permalink
clarify cont
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
baude committed Jan 12, 2020
1 parent 2d5fd7c commit abab2b2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/podman/containers_prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func init() {
pruneContainersCommand.SetHelpTemplate(HelpTemplate())
pruneContainersCommand.SetUsageTemplate(UsageTemplate())
flags := pruneContainersCommand.Flags()
flags.BoolVarP(&pruneContainersCommand.Force, "force", "f", false, "Force removal of a running container. The default is false")
flags.BoolVarP(&pruneContainersCommand.Force, "force", "f", false, "Skip interactive prompt for container removal.")
flags.StringArrayVar(&pruneContainersCommand.Filter, "filter", []string{}, "Provide filter values (e.g. 'until=<timestamp>')")
}

Expand Down
3 changes: 3 additions & 0 deletions docs/source/markdown/podman-container-prune.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ podman-container-prune - Remove all stopped containers from local storage

## OPTIONS

**--force**, **-f**
Do not provide an interactive prompt for containers removal.

**-h**, **--help**

Print usage statement
Expand Down
4 changes: 2 additions & 2 deletions pkg/adapter/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ func (r *LocalRuntime) ExecContainer(ctx context.Context, cli *cliconfig.ExecVal
}

// Prune removes stopped containers
func (r *LocalRuntime) Prune(ctx context.Context, maxWorkers int, force bool, filters []string) ([]string, map[string]error, error) {
func (r *LocalRuntime) Prune(ctx context.Context, maxWorkers int, filters []string) ([]string, map[string]error, error) {
var (
ok = []string{}
failures = map[string]error{}
Expand Down Expand Up @@ -1100,7 +1100,7 @@ func (r *LocalRuntime) Prune(ctx context.Context, maxWorkers int, force bool, fi
pool.Add(shared.Job{
ID: ctr.ID(),
Fn: func() error {
err := r.Runtime.RemoveContainer(ctx, ctr, force, false)
err := r.Runtime.RemoveContainer(ctx, ctr, false, false)
if err != nil {
logrus.Debugf("Failed to prune container %s: %s", ctr.ID(), err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/containers_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ func (r *LocalRuntime) Top(cli *cliconfig.TopValues) ([]string, error) {
}

// Prune removes stopped containers
func (r *LocalRuntime) Prune(ctx context.Context, maxWorkers int, force bool, filter []string) ([]string, map[string]error, error) {
func (r *LocalRuntime) Prune(ctx context.Context, maxWorkers int, filter []string) ([]string, map[string]error, error) {

var (
ok = []string{}
Expand Down

0 comments on commit abab2b2

Please sign in to comment.