Merge pull request #29218 from yongtang/28884-secret-inspect-follow-up

Move secret name or ID prefix resolving from client to daemon
Upstream-commit: 3c32e1775a174edfc6883a7167326bc91bc2eb24
Component: engine
This commit is contained in:
Alexander Morozov
2017-01-27 13:31:04 -08:00
committed by GitHub
4 changed files with 66 additions and 22 deletions

View File

@ -33,13 +33,9 @@ func runSecretInspect(dockerCli *command.DockerCli, opts inspectOptions) error {
client := dockerCli.Client()
ctx := context.Background()
ids, err := getCliRequestedSecretIDs(ctx, client, opts.names)
if err != nil {
return err
}
getRef := func(id string) (interface{}, []byte, error) {
return client.SecretInspectWithRaw(ctx, id)
}
return inspect.Inspect(dockerCli.Out(), ids, opts.format, getRef)
return inspect.Inspect(dockerCli.Out(), opts.names, opts.format, getRef)
}

View File

@ -33,20 +33,15 @@ func runSecretRemove(dockerCli *command.DockerCli, opts removeOptions) error {
client := dockerCli.Client()
ctx := context.Background()
ids, err := getCliRequestedSecretIDs(ctx, client, opts.names)
if err != nil {
return err
}
var errs []string
for _, id := range ids {
if err := client.SecretRemove(ctx, id); err != nil {
for _, name := range opts.names {
if err := client.SecretRemove(ctx, name); err != nil {
errs = append(errs, err.Error())
continue
}
fmt.Fprintln(dockerCli.Out(), id)
fmt.Fprintln(dockerCli.Out(), name)
}
if len(errs) > 0 {