summaryrefslogtreecommitdiff
path: root/cmd/podman/volumes/prune.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-10-01 06:31:36 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-10-01 06:32:57 -0400
commit686ea56480ad80e432a08933fa5f37d48f2ed827 (patch)
treeef7ee5d0d4caa33c80eaa91c90be7d8353cfd5ae /cmd/podman/volumes/prune.go
parent556117c2e95bb0e4da7d36e10d94c3ec0ac4072f (diff)
downloadpodman-686ea56480ad80e432a08933fa5f37d48f2ed827.tar.gz
podman-686ea56480ad80e432a08933fa5f37d48f2ed827.tar.bz2
podman-686ea56480ad80e432a08933fa5f37d48f2ed827.zip
Volume prune should not pass down the force flag
podman volume prune -f Should just tell the prune command to not prompt for confirmation. It should not be passing the prune flag into the API. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/volumes/prune.go')
-rw-r--r--cmd/podman/volumes/prune.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/cmd/podman/volumes/prune.go b/cmd/podman/volumes/prune.go
index 95b47b726..78c258bec 100644
--- a/cmd/podman/volumes/prune.go
+++ b/cmd/podman/volumes/prune.go
@@ -29,10 +29,6 @@ var (
}
)
-var (
- pruneOptions entities.VolumePruneOptions
-)
-
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
@@ -40,12 +36,16 @@ func init() {
Parent: volumeCmd,
})
flags := pruneCommand.Flags()
- flags.BoolVarP(&pruneOptions.Force, "force", "f", false, "Do not prompt for confirmation")
+ flags.BoolP("force", "f", false, "Do not prompt for confirmation")
}
func prune(cmd *cobra.Command, args []string) error {
// Prompt for confirmation if --force is not set
- if !pruneOptions.Force {
+ force, err := cmd.Flags().GetBool("force")
+ if err != nil {
+ return err
+ }
+ if !force {
reader := bufio.NewReader(os.Stdin)
fmt.Println("WARNING! This will remove all volumes not used by at least one container.")
fmt.Print("Are you sure you want to continue? [y/N] ")
@@ -57,7 +57,7 @@ func prune(cmd *cobra.Command, args []string) error {
return nil
}
}
- responses, err := registry.ContainerEngine().VolumePrune(context.Background(), pruneOptions)
+ responses, err := registry.ContainerEngine().VolumePrune(context.Background())
if err != nil {
return err
}