Browse code

Add authorization plugins to docker info

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Vincent Demeester authored on 2015/12/30 06:10:23
Showing 3 changed files
... ...
@@ -2,6 +2,7 @@ package client
2 2
 
3 3
 import (
4 4
 	"fmt"
5
+	"strings"
5 6
 
6 7
 	Cli "github.com/docker/docker/cli"
7 8
 	"github.com/docker/docker/pkg/ioutils"
... ...
@@ -43,16 +44,18 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
43 43
 
44 44
 	fmt.Fprintf(cli.out, "Plugins: \n")
45 45
 	fmt.Fprintf(cli.out, " Volume:")
46
-	for _, driver := range info.Plugins.Volume {
47
-		fmt.Fprintf(cli.out, " %s", driver)
48
-	}
46
+	fmt.Fprintf(cli.out, " %s", strings.Join(info.Plugins.Volume, " "))
49 47
 	fmt.Fprintf(cli.out, "\n")
50 48
 	fmt.Fprintf(cli.out, " Network:")
51
-	for _, driver := range info.Plugins.Network {
52
-		fmt.Fprintf(cli.out, " %s", driver)
53
-	}
49
+	fmt.Fprintf(cli.out, " %s", strings.Join(info.Plugins.Network, " "))
54 50
 	fmt.Fprintf(cli.out, "\n")
55 51
 
52
+	if len(info.Plugins.Authorization) != 0 {
53
+		fmt.Fprintf(cli.out, " Authorization:")
54
+		fmt.Fprintf(cli.out, " %s", strings.Join(info.Plugins.Authorization, " "))
55
+		fmt.Fprintf(cli.out, "\n")
56
+	}
57
+
56 58
 	ioutils.FprintfIfNotEmpty(cli.out, "Kernel Version: %s\n", info.KernelVersion)
57 59
 	ioutils.FprintfIfNotEmpty(cli.out, "Operating System: %s\n", info.OperatingSystem)
58 60
 	ioutils.FprintfIfNotEmpty(cli.out, "OSType: %s\n", info.OSType)
... ...
@@ -243,6 +243,8 @@ type PluginsInfo struct {
243 243
 	Volume []string
244 244
 	// List of Network plugins registered
245 245
 	Network []string
246
+	// List of Authorization plugins registered
247
+	Authorization []string
246 248
 }
247 249
 
248 250
 // ExecStartCheck is a temp struct used by execStart
... ...
@@ -142,9 +142,17 @@ func (daemon *Daemon) showPluginsInfo() types.PluginsInfo {
142 142
 		pluginsInfo.Network = append(pluginsInfo.Network, nd)
143 143
 	}
144 144
 
145
+	pluginsInfo.Authorization = daemon.GetAuthorizationPluginsList()
146
+
145 147
 	return pluginsInfo
146 148
 }
147 149
 
150
+// GetAuthorizationPluginsList returns the list of plugins drivers
151
+// registered for authorization.
152
+func (daemon *Daemon) GetAuthorizationPluginsList() []string {
153
+	return daemon.configStore.AuthZPlugins
154
+}
155
+
148 156
 // The uppercase and the lowercase are available for the proxy settings.
149 157
 // See the Go specification for details on these variables. https://golang.org/pkg/net/http/
150 158
 func getProxyEnv(key string) string {