Output external CAs in swarm mode with docker info

This fix tries to address the issue raised in 25195 where external
CA configurations are not present in `docker info`.

This fix adds the output of external CAs in `docker info` in swarm
mode.

The test is done manually with:
```
docker run -p 8888:8888 -e CXFSSL_ADDRESS=0.0.0.0 -d fabric8/cfssl
docker swarm init --external-ca protocol=cfssl,url=http://172.17.0.2:8888
```

The `docker info` output:
```
 Managers: 1
 Nodes: 1
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot interval: 10000
  Heartbeat tick: 1
  Election tick: 3
 Dispatcher:
  Heartbeat period: 5 seconds
 CA configuration:
  Expiry duration: 3 months
  External CAs:
    cfssl: https://172.17.0.2:8888
```

This fix fixes 25195.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
(cherry picked from commit 995128e9eb)
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Yong Tang 2016-07-28 20:29:58 -07:00 committed by Tibor Vass
parent 828a2473c2
commit aaf3a81086

View file

@ -91,6 +91,12 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
fmt.Fprintf(cli.out, " Heartbeat Period: %s\n", units.HumanDuration(time.Duration(info.Swarm.Cluster.Spec.Dispatcher.HeartbeatPeriod)))
fmt.Fprintf(cli.out, " CA Configuration:\n")
fmt.Fprintf(cli.out, " Expiry Duration: %s\n", units.HumanDuration(info.Swarm.Cluster.Spec.CAConfig.NodeCertExpiry))
if len(info.Swarm.Cluster.Spec.CAConfig.ExternalCAs) > 0 {
fmt.Fprintf(cli.out, " External CAs:\n")
for _, entry := range info.Swarm.Cluster.Spec.CAConfig.ExternalCAs {
fmt.Fprintf(cli.out, " %s: %s\n", entry.Protocol, entry.URL)
}
}
}
fmt.Fprintf(cli.out, " Node Address: %s\n", info.Swarm.NodeAddr)
}