DockerCLI/cli
Sebastiaan van Stijn d38f397da1
Validate stack-names for empty values
Add validation for stack names to prevent an empty name resulting in _all_
stacks to be returned after filtering, which can result in removal of services
for all stacks if `--prune`, or `docker stack rm` is used.

Before this change;

    docker stack deploy -c docker-compose.yml one
    docker stack deploy -c docker-compose.yml two
    docker stack deploy -c docker-compose.yml three

    docker stack deploy -c docker-compose.yml --prune ''
    Removing service one_web
    Removing service two_web
    Removing service three_web

After this change:

    docker stack deploy -c docker-compose.yml one
    docker stack deploy -c docker-compose.yml two
    docker stack deploy -c docker-compose.yml three

    docker stack deploy -c docker-compose.yml --prune ''
    invalid stack name: ""

Other stack commands were updated as well:

Before this change;

    docker stack deploy -c docker-compose.yml ''
    Creating network _default
    failed to create network _default: Error response from daemon: rpc error: code = InvalidArgument desc = name must be valid as a DNS name component

    docker stack ps ''
    nothing found in stack:

    docker stack rm ''
    Removing service one_web
    Removing service three_web
    Removing service two_web

After this change:

    docker stack deploy -c docker-compose.yml ''
    invalid stack name: ""

    docker stack ps ''
    invalid stack name: ""

    docker stack rm ''
    invalid stack name: ""

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-05-28 17:03:26 +02:00
..
command Validate stack-names for empty values 2018-05-28 17:03:26 +02:00
compose Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
config Check allNamespace config value while loading configuration file 2018-05-28 15:15:25 +02:00
debug updated vendoring 2017-09-01 19:41:06 -04:00
flags --orchestrator flag is now a persistent flag 2018-05-28 10:43:32 +02:00
manifest Convert assert.Check(t, is.Error()) to assert.Error 2018-03-06 16:00:28 -05:00
registry/client Bump moby to d37f5c6bdf788a6cb82c07fb707e31a240eff5f9 2018-05-18 11:44:14 +02:00
trust Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
winresources Add windows resources to binary. 2017-05-15 18:03:03 -04:00
cobra.go Hide [flags] in usage output 2018-05-19 02:51:55 +02:00
error.go Import docker/docker/cli 2017-04-17 17:40:59 -04:00
required.go Singularize / pluralize "argument(s)" in error message 2017-08-12 18:25:38 +02:00
required_test.go Post migration fixes 2018-03-05 19:41:17 -05:00
version.go Fix grammar typo in comment 2018-02-28 11:29:40 -05:00