(ctx context.Context, dockerCLI command.Cli, opts caOptions)
| 111 | } |
| 112 | |
| 113 | func attach(ctx context.Context, dockerCLI command.Cli, opts caOptions) error { |
| 114 | apiClient := dockerCLI.Client() |
| 115 | errChan := make(chan error, 1) |
| 116 | pipeReader, pipeWriter := io.Pipe() |
| 117 | |
| 118 | go func() { |
| 119 | errChan <- progress.RootRotationProgress(ctx, apiClient, pipeWriter) |
| 120 | }() |
| 121 | |
| 122 | if opts.quiet { |
| 123 | go io.Copy(io.Discard, pipeReader) |
| 124 | return <-errChan |
| 125 | } |
| 126 | |
| 127 | err := jsonstream.Display(ctx, pipeReader, dockerCLI.Out()) |
| 128 | if err == nil { |
| 129 | err = <-errChan |
| 130 | } |
| 131 | if err != nil { |
| 132 | return err |
| 133 | } |
| 134 | |
| 135 | res, err := apiClient.SwarmInspect(ctx, client.SwarmInspectOptions{}) |
| 136 | if err != nil { |
| 137 | return err |
| 138 | } |
| 139 | return displayTrustRoot(dockerCLI.Out(), res) |
| 140 | } |
| 141 | |
| 142 | func displayTrustRoot(out io.Writer, info client.SwarmInspectResult) error { |
| 143 | if info.Swarm.ClusterInfo.TLSInfo.TrustRoot == "" { |
no test coverage detected
searching dependent graphs…