Pārlūkot izejas kodu

change secret remove logic in cli

Signed-off-by: allencloud <allen.sun@daocloud.io>
(cherry picked from commit 5b93e77138f19d30245a3e0f9f8f834aa67458ec)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
allencloud 8 gadi atpakaļ
vecāks
revīzija
1b187660c2
1 mainītis faili ar 9 papildinājumiem un 1 dzēšanām
  1. 9 1
      cli/command/secret/remove.go

+ 9 - 1
cli/command/secret/remove.go

@@ -2,6 +2,7 @@ package secret
 
 
 import (
 import (
 	"fmt"
 	"fmt"
+	"strings"
 
 
 	"github.com/docker/docker/cli"
 	"github.com/docker/docker/cli"
 	"github.com/docker/docker/cli/command"
 	"github.com/docker/docker/cli/command"
@@ -36,13 +37,20 @@ func runSecretRemove(dockerCli *command.DockerCli, opts removeOptions) error {
 		return err
 		return err
 	}
 	}
 
 
+	var errs []string
+
 	for _, id := range ids {
 	for _, id := range ids {
 		if err := client.SecretRemove(ctx, id); err != nil {
 		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)
 		fmt.Fprintln(dockerCli.Out(), id)
 	}
 	}
 
 
+	if len(errs) > 0 {
+		return fmt.Errorf("%s", strings.Join(errs, "\n"))
+	}
+
 	return nil
 	return nil
 }
 }