From 0af7b5f83d7f66a013e9bd66a9b4066a1de4eae8 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Wed, 30 Jul 2014 09:12:38 +0000 Subject: [PATCH] New job "log": logs a new event Docker-DCO-1.1-Signed-off-by: Solomon Hykes (github: shykes) --- server/events.go | 10 ++++++++++ server/init.go | 1 + 2 files changed, 11 insertions(+) diff --git a/server/events.go b/server/events.go index 0f13d0885e..214dd69e04 100644 --- a/server/events.go +++ b/server/events.go @@ -71,6 +71,16 @@ func (srv *Server) Events(job *engine.Job) engine.Status { } } +// FIXME: this is a shim to allow breaking up other parts of Server without +// dragging the sphagetti dependency along. +func (srv *Server) Log(job *engine.Job) engine.Status { + if len(job.Args) != 3 { + return job.Errorf("usage: %s ACTION ID FROM", job.Name) + } + srv.LogEvent(job.Args[0], job.Args[1], job.Args[2]) + return engine.StatusOK +} + func (srv *Server) LogEvent(action, id, from string) *utils.JSONMessage { now := time.Now().UTC().Unix() jm := utils.JSONMessage{Status: action, ID: id, From: from, Time: now} diff --git a/server/init.go b/server/init.go index cbc5cddaf1..961c7064f3 100644 --- a/server/init.go +++ b/server/init.go @@ -105,6 +105,7 @@ func InitServer(job *engine.Job) engine.Status { "history": srv.ImageHistory, "viz": srv.ImagesViz, "container_copy": srv.ContainerCopy, + "log": srv.Log, "logs": srv.ContainerLogs, "changes": srv.ContainerChanges, "top": srv.ContainerTop,