Fix weave tagger crash

This commit is contained in:
Alfonso Acosta
2016-02-17 18:53:43 +00:00
parent 07d34205ce
commit 1e3014c417

View File

@@ -134,9 +134,15 @@ func (w *Weave) Tag(r report.Report) (report.Report, error) {
}
// Put information from weave ps on the container nodes
const maxPrefixSize = 12
for id, node := range r.Container.Nodes {
prefix, _ := node.Latest.Lookup(docker.ContainerID)
prefix = prefix[:12]
prefix, ok := node.Latest.Lookup(docker.ContainerID)
if !ok {
continue
}
if len(prefix) > maxPrefixSize {
prefix = prefix[:maxPrefixSize]
}
entry, ok := w.psCache[prefix]
if !ok {
continue