daemon/info: don't sort authorization plugins as order matters

plugins exist in a chain that composes potentially mutating requests and
responses. This simply reverts the sorting of AuthZ plugins so that the
/info API endpoint returns the internal ordering used for AuthZ composition.

Volume driver plugins are not affected because they are just a set.

Signed-off-by: David Sheets <dsheets@docker.com>
This commit is contained in:
David Sheets 2017-04-30 17:24:12 +01:00
parent 73abe0c682
commit cfcf2a0cec
2 changed files with 3 additions and 15 deletions

View file

@ -9,7 +9,6 @@ import (
"io/ioutil" "io/ioutil"
"reflect" "reflect"
"runtime" "runtime"
"sort"
"strings" "strings"
"sync" "sync"
@ -503,19 +502,6 @@ func Validate(config *Config) error {
return nil return nil
} }
// GetAuthorizationPlugins returns daemon's sorted authorization plugins
func (conf *Config) GetAuthorizationPlugins() []string {
conf.Lock()
defer conf.Unlock()
authPlugins := make([]string, 0, len(conf.AuthorizationPlugins))
for _, p := range conf.AuthorizationPlugins {
authPlugins = append(authPlugins, p)
}
sort.Strings(authPlugins)
return authPlugins
}
// ModifiedDiscoverySettings returns whether the discovery configuration has been modified or not. // ModifiedDiscoverySettings returns whether the discovery configuration has been modified or not.
func ModifiedDiscoverySettings(config *Config, backendType, advertise string, clusterOpts map[string]string) bool { func ModifiedDiscoverySettings(config *Config, backendType, advertise string, clusterOpts map[string]string) bool {
if config.ClusterStore != backendType || config.ClusterAdvertise != advertise { if config.ClusterStore != backendType || config.ClusterAdvertise != advertise {

View file

@ -175,7 +175,9 @@ func (daemon *Daemon) showPluginsInfo() types.PluginsInfo {
pluginsInfo.Volume = volumedrivers.GetDriverList() pluginsInfo.Volume = volumedrivers.GetDriverList()
pluginsInfo.Network = daemon.GetNetworkDriverList() pluginsInfo.Network = daemon.GetNetworkDriverList()
pluginsInfo.Authorization = daemon.configStore.GetAuthorizationPlugins() // The authorization plugins are returned in the order they are
// used as they constitute a request/response modification chain.
pluginsInfo.Authorization = daemon.configStore.AuthorizationPlugins
pluginsInfo.Log = logger.ListDrivers() pluginsInfo.Log = logger.ListDrivers()
return pluginsInfo return pluginsInfo