mirror of https://github.com/docker/docs.git
Sort plugin names in node description
Signed-off-by: Nishant Totla <nishanttotla@gmail.com> (cherry picked from commit 227c7e4e8d8ce9ecb74ff1b38fe07cd6c37aee9f) Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
365d16ed6d
commit
bf024205b7
|
|
@ -1,6 +1,7 @@
|
||||||
package container
|
package container
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
executorpkg "github.com/docker/docker/daemon/cluster/executor"
|
executorpkg "github.com/docker/docker/daemon/cluster/executor"
|
||||||
|
|
@ -47,6 +48,8 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
||||||
addPlugins("Network", append([]string{"overlay"}, info.Plugins.Network...))
|
addPlugins("Network", append([]string{"overlay"}, info.Plugins.Network...))
|
||||||
addPlugins("Authorization", info.Plugins.Authorization)
|
addPlugins("Authorization", info.Plugins.Authorization)
|
||||||
|
|
||||||
|
sort.Sort(sortedPlugins(plugins))
|
||||||
|
|
||||||
// parse []string labels into a map[string]string
|
// parse []string labels into a map[string]string
|
||||||
labels := map[string]string{}
|
labels := map[string]string{}
|
||||||
for _, l := range info.Labels {
|
for _, l := range info.Labels {
|
||||||
|
|
@ -137,3 +140,16 @@ func (e *executor) SetNetworkBootstrapKeys(keys []*api.EncryptionKey) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type sortedPlugins []api.PluginDescription
|
||||||
|
|
||||||
|
func (sp sortedPlugins) Len() int { return len(sp) }
|
||||||
|
|
||||||
|
func (sp sortedPlugins) Swap(i, j int) { sp[i], sp[j] = sp[j], sp[i] }
|
||||||
|
|
||||||
|
func (sp sortedPlugins) Less(i, j int) bool {
|
||||||
|
if sp[i].Type != sp[j].Type {
|
||||||
|
return sp[i].Type < sp[j].Type
|
||||||
|
}
|
||||||
|
return sp[i].Name < sp[j].Name
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue