From 0227275b7f8d09ed5c8787ca8ac534a95cbcac11 Mon Sep 17 00:00:00 2001 From: allencloud Date: Tue, 29 Nov 2016 14:28:46 +0800 Subject: [PATCH] change secret remove logic in cli Signed-off-by: allencloud --- command/secret/remove.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/command/secret/remove.go b/command/secret/remove.go index 5026a437f8..97d1f445ca 100644 --- a/command/secret/remove.go +++ b/command/secret/remove.go @@ -2,6 +2,7 @@ package secret import ( "fmt" + "strings" "github.com/docker/docker/cli" "github.com/docker/docker/cli/command" @@ -36,13 +37,20 @@ func runSecretRemove(dockerCli *command.DockerCli, opts removeOptions) error { return err } + var errs []string + for _, id := range ids { if err := client.SecretRemove(ctx, id); err != nil { - fmt.Fprintf(dockerCli.Out(), "WARN: %s\n", err) + errs = append(errs, err.Error()) + continue } fmt.Fprintln(dockerCli.Out(), id) } + if len(errs) > 0 { + return fmt.Errorf("%s", strings.Join(errs, "\n")) + } + return nil }