From e2eef50cda29b0871135c947918be2003595aaf6 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Sun, 24 Dec 2017 21:32:15 +0000 Subject: [PATCH] eliminate (out-of-date) list of topologies in plugin code --- probe/plugins/registry.go | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/probe/plugins/registry.go b/probe/plugins/registry.go index 11d9d1db1..9b46f88e8 100644 --- a/probe/plugins/registry.go +++ b/probe/plugins/registry.go @@ -231,32 +231,13 @@ func (r *Registry) updateAndRegisterControlsInReport(rpt *report.Report) { key := rpt.Plugins.Keys()[0] spec, _ := rpt.Plugins.Lookup(key) pluginID := spec.ID - topologies := topologyPointers(rpt) var newPluginControls []string - for _, topology := range topologies { + rpt.WalkTopologies(func(topology *report.Topology) { newPluginControls = append(newPluginControls, r.updateAndGetControlsInTopology(pluginID, topology)...) - } + }) r.updatePluginControls(pluginID, report.MakeStringSet(newPluginControls...)) } -func topologyPointers(rpt *report.Report) []*report.Topology { - // We cannot use rpt.Topologies(), because it makes a slice of - // topology copies and we need original locations to modify - // them. - return []*report.Topology{ - &rpt.Endpoint, - &rpt.Process, - &rpt.Container, - &rpt.ContainerImage, - &rpt.Pod, - &rpt.Service, - &rpt.Deployment, - &rpt.ReplicaSet, - &rpt.Host, - &rpt.Overlay, - } -} - func (r *Registry) updateAndGetControlsInTopology(pluginID string, topology *report.Topology) []string { var pluginControls []string newControls := report.Controls{}