Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
| ... | ... |
@@ -32,13 +32,13 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
| 32 | 32 |
return nil, err |
| 33 | 33 |
} |
| 34 | 34 |
|
| 35 |
- var plugins []api.PluginDescription |
|
| 35 |
+ plugins := map[api.PluginDescription]struct{}{}
|
|
| 36 | 36 |
addPlugins := func(typ string, names []string) {
|
| 37 | 37 |
for _, name := range names {
|
| 38 |
- plugins = append(plugins, api.PluginDescription{
|
|
| 38 |
+ plugins[api.PluginDescription{
|
|
| 39 | 39 |
Type: typ, |
| 40 | 40 |
Name: name, |
| 41 |
- }) |
|
| 41 |
+ }] = struct{}{}
|
|
| 42 | 42 |
} |
| 43 | 43 |
} |
| 44 | 44 |
|
| ... | ... |
@@ -48,7 +48,12 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
| 48 | 48 |
addPlugins("Network", append([]string{"overlay"}, info.Plugins.Network...))
|
| 49 | 49 |
addPlugins("Authorization", info.Plugins.Authorization)
|
| 50 | 50 |
|
| 51 |
- sort.Sort(sortedPlugins(plugins)) |
|
| 51 |
+ pluginFields := make([]api.PluginDescription, 0, len(plugins)) |
|
| 52 |
+ for k := range plugins {
|
|
| 53 |
+ pluginFields = append(pluginFields, k) |
|
| 54 |
+ } |
|
| 55 |
+ |
|
| 56 |
+ sort.Sort(sortedPlugins(pluginFields)) |
|
| 52 | 57 |
|
| 53 | 58 |
// parse []string labels into a map[string]string |
| 54 | 59 |
labels := map[string]string{}
|
| ... | ... |
@@ -70,7 +75,7 @@ func (e *executor) Describe(ctx context.Context) (*api.NodeDescription, error) {
|
| 70 | 70 |
Engine: &api.EngineDescription{
|
| 71 | 71 |
EngineVersion: info.ServerVersion, |
| 72 | 72 |
Labels: labels, |
| 73 |
- Plugins: plugins, |
|
| 73 |
+ Plugins: pluginFields, |
|
| 74 | 74 |
}, |
| 75 | 75 |
Resources: &api.Resources{
|
| 76 | 76 |
NanoCPUs: int64(info.NCPU) * 1e9, |