DockerCLI/cli/command
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
..
bundlefile Convert assert.Check(t, is.Error()) to assert.Error 2018-03-06 16:00:28 -05:00
checkpoint Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
commands add manifest command 2018-01-08 10:43:56 -06:00
config Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
container cli/command/container: don't leak context 2018-05-11 16:50:04 -07:00
formatter Merge pull request #1037 from essamhassan/1036_fix_mounts_typo_in_srv_inspect_pretty 2018-05-14 10:55:41 +02:00
idresolver Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
image Merge pull request #1053 from justyntemme/patch-3 2018-05-22 00:12:46 +02:00
inspect Automated migration 2018-03-05 19:41:17 -05:00
manifest Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
network Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
node Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
plugin Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
registry Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
secret Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
service Minor refactor: use anyChanged() to detect changed flags 2018-05-24 01:30:09 +02:00
stack Validate stack-names for empty values 2018-05-28 17:03:26 +02:00
swarm Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
system Merge pull request #1043 from justyntemme/patch-2 2018-05-22 00:26:26 +02:00
task Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
trust Fixed gometalinter errors on test files 2018-04-10 16:03:56 +02:00
volume Bump moby to d37f5c6bdf788a6cb82c07fb707e31a240eff5f9 2018-05-18 11:44:14 +02:00
cli.go Support 'all' in orchestrator flag for docker stack ls 2018-05-15 15:38:41 +02:00
cli_test.go Support 'all' in orchestrator flag for docker stack ls 2018-05-15 15:38:41 +02:00
events_utils.go updated vendoring 2017-09-01 19:41:06 -04:00
in.go Fix docker run -it on windows 2017-05-03 18:41:19 -07:00
orchestrator.go Support 'all' in orchestrator flag for docker stack ls 2018-05-15 15:38:41 +02:00
out.go updated vendoring 2017-09-01 19:41:06 -04:00
registry.go Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
registry_test.go Switch from x/net/context to context 2018-05-11 16:49:43 -07:00
stream.go Fix docker run -it on windows 2017-05-03 18:41:19 -07:00
trust.go Refactor content_trust cli/flags handling 2018-03-08 15:00:43 -05:00
utils.go LCOW: Add `--platform=` CLI flag to pull/create/run/build 2017-10-31 09:50:43 -07:00