remove API-version compatibility for API < v1.44
Support for API versions < v1.44 was removed in the client in [moby@96b29f5] and [moby@7652f38], so we can remove fallback-code from the CLI as well, as it won't be able to use those versions. [moby@96b29f5]: https://github.com/moby/moby/commit/96b29f5a1f7fc5e5d8b2b4dbd130e215bbb92ae9 [moby@7652f38]: https://github.com/moby/moby/commit/7652f38c289909bc61b1113c0570b9de345bbed9 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/docker/cli/internal/prompt"
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/moby/moby/api/types/versions"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -72,16 +71,11 @@ func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions)
|
||||
pruneFilters := command.PruneFilters(dockerCli, options.filter.Value())
|
||||
|
||||
warning := unusedVolumesWarning
|
||||
if versions.GreaterThanOrEqualTo(dockerCli.CurrentVersion(), "1.42") {
|
||||
if options.all {
|
||||
if _, ok := pruneFilters["all"]; ok {
|
||||
return 0, "", invalidParamErr{errors.New("conflicting options: cannot specify both --all and --filter all=1")}
|
||||
}
|
||||
pruneFilters.Add("all", "true")
|
||||
warning = allVolumesWarning
|
||||
if options.all {
|
||||
if _, ok := pruneFilters["all"]; ok {
|
||||
return 0, "", invalidParamErr{errors.New("conflicting options: cannot specify both --all and --filter all=1")}
|
||||
}
|
||||
} else {
|
||||
// API < v1.42 removes all volumes (anonymous and named) by default.
|
||||
pruneFilters.Add("all", "true")
|
||||
warning = allVolumesWarning
|
||||
}
|
||||
if !options.force {
|
||||
|
||||
Reference in New Issue
Block a user