DockerCLI/cli/command/system
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
..
client_test.go Fix: skip build-cache prune on unsupported versions 2017-07-17 11:55:35 +02:00
cmd.go Unexport subcommands 2017-07-18 15:26:45 +02:00
df.go Unexport subcommands 2017-07-18 15:26:45 +02:00
events.go Update cli imports to using local package 2017-05-15 14:45:19 +02:00
info.go Add gosimple lint 2017-06-14 16:55:08 -07:00
inspect.go Use `scope=swarm` for service related network inspect. 2017-06-13 20:26:12 +00:00
prune.go Error if "until" filter is combined with "--volumes" on system prune 2017-07-21 12:11:53 +02:00
prune_test.go Unexport subcommands 2017-07-18 15:26:45 +02:00
version.go Display proper version information 2017-05-09 14:22:51 -07:00