Review feedback

This commit is contained in:
Tom Wilkie
2015-08-26 13:00:33 +00:00
parent d8ac16d3f3
commit 1ad1197051
3 changed files with 10 additions and 2 deletions
+5
View File
@@ -244,3 +244,8 @@ func (c *container) GetNodeMetadata() report.NodeMetadata {
}))
return result
}
// ExtractContainerIPs returns the list of container IPs given a NodeMetadata from the Container topology.
func ExtractContainerIPs(nmd report.NodeMetadata) []string {
return strings.Fields(nmd.Metadata[ContainerIPs])
}
+1 -1
View File
@@ -150,7 +150,7 @@ func (w Weave) tagContainer(r report.Report, containerIDPrefix, macAddress strin
continue
}
existingIPs := report.MakeIDList(strings.Fields(nmd.Metadata[docker.ContainerIPs])...)
existingIPs := report.MakeIDList(docker.ExtractContainerIPs(nmd)...)
existingIPs = existingIPs.Add(ips...)
nmd.Metadata[docker.ContainerIPs] = strings.Join(existingIPs, " ")
nmd.Metadata[WeaveMACAddress] = macAddress
+4 -1
View File
@@ -301,7 +301,6 @@ func containerOriginTable(nmd report.NodeMetadata, addHostTag bool) (Table, bool
{docker.ContainerPorts, "Ports"},
{docker.ContainerCreated, "Created"},
{docker.ContainerCommand, "Command"},
{docker.ContainerIPs, "IP Addresses"},
{overlay.WeaveMACAddress, "Weave MAC"},
{overlay.WeaveDNSHostname, "Weave DNS Hostname"},
} {
@@ -310,6 +309,10 @@ func containerOriginTable(nmd report.NodeMetadata, addHostTag bool) (Table, bool
}
}
for _, ip := range docker.ExtractContainerIPs(nmd) {
rows = append(rows, Row{Key: "IP Address", ValueMajor: ip, ValueMinor: ""})
}
if val, ok := nmd.Metadata[docker.MemoryUsage]; ok {
memory, err := strconv.ParseFloat(val, 64)
if err == nil {