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

sort volume drivers and auth plugins in info response

Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
allencloud 2017-01-22 14:59:29 +08:00
parent 9c94fa4563
commit 1d1362bdb2
3 changed files with 17 additions and 1 deletions

View file

@ -8,6 +8,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"runtime" "runtime"
"sort"
"strings" "strings"
"sync" "sync"
@ -523,3 +524,16 @@ func ValidateConfiguration(config *Config) error {
return nil return nil
} }
// GetAuthorizationPlugins returns daemon's sorted authorization plugins
func (config *Config) GetAuthorizationPlugins() []string {
config.reloadLock.Lock()
defer config.reloadLock.Unlock()
authPlugins := make([]string, 0, len(config.AuthorizationPlugins))
for _, p := range config.AuthorizationPlugins {
authPlugins = append(authPlugins, p)
}
sort.Strings(authPlugins)
return authPlugins
}

View file

@ -174,7 +174,7 @@ 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.AuthorizationPlugins pluginsInfo.Authorization = daemon.configStore.GetAuthorizationPlugins()
return pluginsInfo return pluginsInfo
} }

View file

@ -4,6 +4,7 @@ package volumedrivers
import ( import (
"fmt" "fmt"
"sort"
"sync" "sync"
"github.com/docker/docker/pkg/locker" "github.com/docker/docker/pkg/locker"
@ -176,6 +177,7 @@ func GetDriverList() []string {
driverList = append(driverList, driverName) driverList = append(driverList, driverName)
} }
drivers.Unlock() drivers.Unlock()
sort.Strings(driverList)
return driverList return driverList
} }