Merge pull request #24969 from runcom/fix-network-info

daemon: no map[string]bool from GetNetworkDriverList
This commit is contained in:
Michael Crosby 2016-08-24 09:49:06 -07:00 коммит произвёл GitHub
Родитель b29558ed5d 7ca635a1ec
Коммит c8b55c19cf
2 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -175,12 +175,7 @@ func (daemon *Daemon) showPluginsInfo() types.PluginsInfo {
var pluginsInfo types.PluginsInfo
pluginsInfo.Volume = volumedrivers.GetDriverList()
networkDriverList := daemon.GetNetworkDriverList()
for nd := range networkDriverList {
pluginsInfo.Network = append(pluginsInfo.Network, nd)
}
pluginsInfo.Network = daemon.GetNetworkDriverList()
pluginsInfo.Authorization = daemon.configStore.AuthorizationPlugins
return pluginsInfo

Просмотреть файл

@ -3,6 +3,7 @@ package daemon
import (
"fmt"
"net"
"sort"
"strings"
"github.com/Sirupsen/logrus"
@ -328,21 +329,25 @@ func (daemon *Daemon) DisconnectContainerFromNetwork(containerName string, netwo
// GetNetworkDriverList returns the list of plugins drivers
// registered for network.
func (daemon *Daemon) GetNetworkDriverList() map[string]bool {
pluginList := make(map[string]bool)
func (daemon *Daemon) GetNetworkDriverList() []string {
pluginList := []string{}
pluginMap := make(map[string]bool)
if !daemon.NetworkControllerEnabled() {
return nil
}
c := daemon.netController
networks := c.Networks()
networks := daemon.netController.Networks()
for _, network := range networks {
driver := network.Type()
pluginList[driver] = true
if !pluginMap[network.Type()] {
pluginList = append(pluginList, network.Type())
pluginMap[network.Type()] = true
}
}
// TODO : Replace this with proper libnetwork API
pluginList["overlay"] = true
pluginList = append(pluginList, "overlay")
sort.Strings(pluginList)
return pluginList
}