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

Merge pull request #30474 from allencloud/sort-volume-drivers

sort volume drivers  and auth plugins in info response
This commit is contained in:
Brian Goff 2017-02-07 21:13:21 -05:00 committed by GitHub
commit 41650df87e
3 changed files with 17 additions and 1 deletions

View file

@ -8,6 +8,7 @@ import (
"io"
"io/ioutil"
"runtime"
"sort"
"strings"
"sync"
@ -523,3 +524,16 @@ func ValidateConfiguration(config *Config) error {
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.Network = daemon.GetNetworkDriverList()
pluginsInfo.Authorization = daemon.configStore.AuthorizationPlugins
pluginsInfo.Authorization = daemon.configStore.GetAuthorizationPlugins()
return pluginsInfo
}

View file

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