Browse code

Only output security options if there are any

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/09/08 03:14:49
Showing 2 changed files
... ...
@@ -135,9 +135,11 @@ func prettyPrintInfo(dockerCli *command.DockerCli, info types.Info) error {
135 135
 		fmt.Fprintf(dockerCli.Out(), "Default Runtime: %s\n", info.DefaultRuntime)
136 136
 	}
137 137
 
138
-	fmt.Fprintf(dockerCli.Out(), "Security Options:")
139
-	ioutils.FprintfIfNotEmpty(dockerCli.Out(), " %s", strings.Join(info.SecurityOptions, " "))
140
-	fmt.Fprintf(dockerCli.Out(), "\n")
138
+	if info.OSType == "linux" {
139
+		fmt.Fprintf(dockerCli.Out(), "Security Options:")
140
+		ioutils.FprintfIfNotEmpty(dockerCli.Out(), " %s", strings.Join(info.SecurityOptions, " "))
141
+		fmt.Fprintf(dockerCli.Out(), "\n")
142
+	}
141 143
 
142 144
 	ioutils.FprintfIfNotEmpty(dockerCli.Out(), "Kernel Version: %s\n", info.KernelVersion)
143 145
 	ioutils.FprintfIfNotEmpty(dockerCli.Out(), "Operating System: %s\n", info.OperatingSystem)
... ...
@@ -33,10 +33,13 @@ func (s *DockerSuite) TestInfoEnsureSucceeds(c *check.C) {
33 33
 		"Storage Driver:",
34 34
 		"Volume:",
35 35
 		"Network:",
36
-		"Security Options:",
37 36
 		"Live Restore Enabled:",
38 37
 	}
39 38
 
39
+	if daemonPlatform == "linux" {
40
+		stringsToCheck = append(stringsToCheck, "Security Options:")
41
+	}
42
+
40 43
 	if DaemonIsLinux.Condition() {
41 44
 		stringsToCheck = append(stringsToCheck, "Runtimes:", "Default Runtime: runc")
42 45
 	}