moby--moby/cmd
Sebastiaan van Stijn 15d63f1c5b Improve error handling of commands run against unsupported daemon
The current error-handling only checked for version annotations
on the subcommand itself, but did not check the top-level command.

This patch always traverses the command path (parents), and
prints an error if the command is not supported.

Before this change:

    $ docker service
    Usage:	docker service COMMAND

    Manage services

    Options:
          --help   Print usage

    Commands:
      create      Create a new service
      inspect     Display detailed information on one or more services
      ls          List services
      ps          List the tasks of one or more services
      rm          Remove one or more services
      scale       Scale one or multiple replicated services
      update      Update a service

    Run 'docker service COMMAND --help' for more information on a command.

    $ docker service ls
    ID                  NAME                MODE                REPLICAS            IMAGE

After this change:

    $ DOCKER_API_VERSION=1.12 docker service
    docker service requires API version 1.24, but the Docker daemon API version is 1.12

    $ DOCKER_API_VERSION=1.12 docker service ls
    docker service ls requires API version 1.24, but the Docker daemon API version is 1.12

    $ DOCKER_API_VERSION=1.24 docker plugin --help
    docker plugin requires API version 1.25, but the Docker daemon API version is 1.24

    $ DOCKER_API_VERSION=1.25 docker plugin upgrade --help
    docker plugin upgrade requires API version 1.26, but the Docker daemon API version is 1.25

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-03-16 13:45:50 +01:00
..
docker Improve error handling of commands run against unsupported daemon 2017-03-16 13:45:50 +01:00
dockerd 'docker daemon' deprecation message doesn't use the new versioning scheme 2017-03-03 17:26:49 +08:00