DockerCLI/cli/command
Sebastiaan van Stijn 3c095dc546
Error if "until" filter is combined with "--volumes" on system prune
The "until" filter is supported by all object types, except for
volumes.

Before this patch, the "until" filter would attempted to be used for the volume
prune endpoint, resulting in an error being returned by the daemon, and
further prune endpoints (networks, images) to be skipped.

    $ docker system prune --filter until=24h --filter label=label.foo=bar

    WARNING! This will remove:
            - all stopped containers
            - all volumes not used by at least one container
            - all networks not used by at least one container
            - all dangling images
    Are you sure you want to continue? [y/N] y
    Error response from daemon: Invalid filter 'until'

    Calling POST /v1.30/containers/prune?filters=%7B%22label%22%3A%7B%22label.foo%3D%3Dbar%22%3Atrue%7D%2C%22until%22%3A%7B%2224h%22%3Atrue%7D%7D
    Calling POST /v1.30/volumes/prune?filters=%7B%22label%22%3A%7B%22label.foo%3D%3Dbar%22%3Atrue%7D%2C%22until%22%3A%7B%2224h%22%3Atrue%7D%7D
    Handler for POST /v1.30/volumes/prune returned error: Invalid filter 'until'
    Error response from daemon: Invalid filter 'until'

With this patch, an error is produced instead, preventing "partial" prune.

    $ docker system prune --filter until=24h --filter label=foo==bar --volumes
    ERROR: The "until" filter is not supported with "--volumes"

Note that `docker volume prune` does not have this problem, and produces an
error if the `until` filter is used;

    $ docker volume prune --filter until=24h

    WARNING! This will remove all volumes not used by at least one container.
    Are you sure you want to continue? [y/N] y
    Error response from daemon: Invalid filter 'until'

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-21 12:11:53 +02:00
..
bundlefile Import docker/docker/cli 2017-04-17 17:40:59 -04:00
checkpoint Update some tests to remove unnecessary buffers. 2017-07-11 17:52:43 -04:00
commands Add support for configs 2017-05-11 13:42:49 -07:00
config Update some tests to remove unnecessary buffers. 2017-07-11 17:52:43 -04:00
container Update some tests to remove unnecessary buffers. 2017-07-11 17:52:43 -04:00
formatter Pin all tools used in the Dockerfiles 2017-07-11 14:23:27 -04:00
idresolver cli: gofmt + goimports 2017-05-08 10:51:30 -07:00
image Update some tests to remove unnecessary buffers. 2017-07-11 17:52:43 -04:00
inspect Unmarshal a number as a Number in RawInspectFallback 2017-06-21 13:10:14 +03:00
network adding connect disconnect network tests 2017-07-20 18:53:03 +02:00
node Sort swarm stacks and nodes using natural sorting 2017-07-13 14:33:02 +03:00
plugin Update cli imports to using local package 2017-05-15 14:45:19 +02:00
registry login: add a --password-stdin argument 2017-07-11 12:16:29 -06:00
secret Update some tests to remove unnecessary buffers. 2017-07-11 17:52:43 -04:00
service Sort services names in a natural order 2017-07-19 18:18:06 +03:00
stack Add myself to command/stack codeowners 2017-07-20 12:05:20 -04:00
swarm Fix warning in docker CLI when `swarm ca --ca-cert`, etc. flags are passed, 2017-07-12 14:56:28 -07:00
system Error if "until" filter is combined with "--volumes" on system prune 2017-07-21 12:11:53 +02:00
task Update FakeCli to remove duplication in tests. 2017-07-11 14:49:30 -04:00
volume Update some tests to remove unnecessary buffers. 2017-07-11 17:52:43 -04:00
cli.go Rename NewConfigFile to New in configfile package 2017-06-27 16:31:38 +02:00
events_utils.go Add deadcode linter. 2017-05-02 17:57:46 -04:00
in.go Fix docker run -it on windows 2017-05-03 18:41:19 -07:00
out.go Fix docker run -it on windows 2017-05-03 18:41:19 -07:00
registry.go Move credential getting functions to the ConfigFile. 2017-06-27 13:46:47 +02:00
registry_test.go Update some tests to remove unnecessary buffers. 2017-07-11 17:52:43 -04:00
stream.go Fix docker run -it on windows 2017-05-03 18:41:19 -07:00
trust.go Import docker/docker/cli 2017-04-17 17:40:59 -04:00
utils.go Add interfacer linter 2017-05-08 15:57:50 -04:00