1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Only output security options if there are any

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2016-09-07 11:14:49 -07:00
parent a4d1365bce
commit dd3d223a7e
2 changed files with 9 additions and 4 deletions

View file

@ -135,9 +135,11 @@ func prettyPrintInfo(dockerCli *command.DockerCli, info types.Info) error {
fmt.Fprintf(dockerCli.Out(), "Default Runtime: %s\n", info.DefaultRuntime) fmt.Fprintf(dockerCli.Out(), "Default Runtime: %s\n", info.DefaultRuntime)
} }
fmt.Fprintf(dockerCli.Out(), "Security Options:") if info.OSType == "linux" {
ioutils.FprintfIfNotEmpty(dockerCli.Out(), " %s", strings.Join(info.SecurityOptions, " ")) fmt.Fprintf(dockerCli.Out(), "Security Options:")
fmt.Fprintf(dockerCli.Out(), "\n") ioutils.FprintfIfNotEmpty(dockerCli.Out(), " %s", strings.Join(info.SecurityOptions, " "))
fmt.Fprintf(dockerCli.Out(), "\n")
}
ioutils.FprintfIfNotEmpty(dockerCli.Out(), "Kernel Version: %s\n", info.KernelVersion) ioutils.FprintfIfNotEmpty(dockerCli.Out(), "Kernel Version: %s\n", info.KernelVersion)
ioutils.FprintfIfNotEmpty(dockerCli.Out(), "Operating System: %s\n", info.OperatingSystem) ioutils.FprintfIfNotEmpty(dockerCli.Out(), "Operating System: %s\n", info.OperatingSystem)

View file

@ -33,10 +33,13 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) {
"Storage Driver:", "Storage Driver:",
"Volume:", "Volume:",
"Network:", "Network:",
"Security Options:",
"Live Restore Enabled:", "Live Restore Enabled:",
} }
if daemonPlatform == "linux" {
stringsToCheck = append(stringsToCheck, "Security Options:")
}
if DaemonIsLinux.Condition() { if DaemonIsLinux.Condition() {
stringsToCheck = append(stringsToCheck, "Runtimes:", "Default Runtime: runc") stringsToCheck = append(stringsToCheck, "Runtimes:", "Default Runtime: runc")
} }