Fix a panic that occurs in the log handler when pulling images.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2015-01-28 12:29:41 -08:00
parent 86a028d7c1
commit acd036365d
1 changed files with 6 additions and 1 deletions

View File

@ -22,7 +22,12 @@ type logHandler struct {
}
func (h *logHandler) Handle(e *cluster.Event) error {
log.WithFields(log.Fields{"node": e.Node.Name, "id": e.Id[:12], "from": e.From, "status": e.Status}).Debug("Event received")
id := e.Id
// Trim IDs to 12 chars.
if len(id) > 12 {
id = id[:12]
}
log.WithFields(log.Fields{"node": e.Node.Name, "id": id, "from": e.From, "status": e.Status}).Debug("Event received")
return nil
}