|
@@ -32,13 +32,13 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
|
|
return nil, err
|
|
|
}
|
|
|
|
|
|
- var plugins []api.PluginDescription
|
|
|
+ plugins := map[api.PluginDescription]struct{}{}
|
|
|
addPlugins := func(typ string, names []string) {
|
|
|
for _, name := range names {
|
|
|
- plugins = append(plugins, api.PluginDescription{
|
|
|
+ plugins[api.PluginDescription{
|
|
|
Type: typ,
|
|
|
Name: name,
|
|
|
- })
|
|
|
+ }] = struct{}{}
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -48,7 +48,12 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
|
|
addPlugins("Network", append([]string{"overlay"}, info.Plugins.Network...))
|
|
|
addPlugins("Authorization", info.Plugins.Authorization)
|
|
|
|
|
|
- sort.Sort(sortedPlugins(plugins))
|
|
|
+ pluginFields := make([]api.PluginDescription, 0, len(plugins))
|
|
|
+ for k := range plugins {
|
|
|
+ pluginFields = append(pluginFields, k)
|
|
|
+ }
|
|
|
+
|
|
|
+ sort.Sort(sortedPlugins(pluginFields))
|
|
|
|
|
|
// parse []string labels into a map[string]string
|
|
|
labels := map[string]string{}
|
|
@@ -70,7 +75,7 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
|
|
Engine: &api.EngineDescription{
|
|
|
EngineVersion: info.ServerVersion,
|
|
|
Labels: labels,
|
|
|
- Plugins: plugins,
|
|
|
+ Plugins: pluginFields,
|
|
|
},
|
|
|
Resources: &api.Resources{
|
|
|
NanoCPUs: int64(info.NCPU) * 1e9,
|