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:
commit
41650df87e
3 changed files with 17 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue