tiny simplifying refactor

This commit is contained in:
Matthias Radestock
2017-12-17 15:36:28 +00:00
parent d428b69492
commit cc859926ef
2 changed files with 8 additions and 14 deletions

View File

@@ -56,13 +56,10 @@ func (e endpoints2Hosts) Render(rpt report.Report) Nodes {
for _, n := range endpoints.Nodes {
// Nodes without a hostid are treated as pseudo nodes
hostNodeID, timestamp, ok := n.Latest.LookupEntry(report.HostNodeID)
if !ok {
id, ok := pseudoNodeID(n, local)
if !ok {
continue
if hostNodeID, timestamp, ok := n.Latest.LookupEntry(report.HostNodeID); !ok {
if id, ok := pseudoNodeID(n, local); ok {
ret.addChild(n, id, newPseudoNode)
}
ret.addChild(n, id, newPseudoNode)
} else {
id := report.MakeHostNodeID(report.ExtractHostID(n))
ret.addChild(n, id, func(id string) report.Node {

View File

@@ -155,14 +155,11 @@ func processes2Names(processes Nodes) Nodes {
for _, n := range processes.Nodes {
if n.Topology == Pseudo {
ret.passThrough(n)
} else {
name, timestamp, ok := n.Latest.LookupEntry(process.Name)
if ok {
ret.addChildAndChildren(n, name, func(id string) report.Node {
return report.MakeNode(id).WithTopology(MakeGroupNodeTopology(n.Topology, process.Name)).
WithLatest(process.Name, timestamp, name)
})
}
} else if name, timestamp, ok := n.Latest.LookupEntry(process.Name); ok {
ret.addChildAndChildren(n, name, func(id string) report.Node {
return report.MakeNode(id).WithTopology(MakeGroupNodeTopology(n.Topology, process.Name)).
WithLatest(process.Name, timestamp, name)
})
}
}
ret.fixupAdjacencies(processes)