add timestamp and change untagged -> untag
Upstream-commit: b8d52ec2669332988a972bff3b5f5d2e9d526b33 Component: engine
This commit is contained in:
@ -19,6 +19,7 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (srv *Server) DockerVersion() APIVersion {
|
||||
@ -953,7 +954,7 @@ func (srv *Server) deleteImage(img *Image, repoName, tag string) ([]APIRmi, erro
|
||||
}
|
||||
if tagDeleted {
|
||||
imgs = append(imgs, APIRmi{Untagged: img.ShortID()})
|
||||
srv.SendEvent("untagged", img.ShortID())
|
||||
srv.SendEvent("untag", img.ShortID())
|
||||
}
|
||||
if len(srv.runtime.repositories.ByID()[img.ID]) == 0 {
|
||||
if err := srv.deleteImageAndChildren(img.ID, &imgs); err != nil {
|
||||
@ -1180,7 +1181,7 @@ func NewServer(flGraphPath string, autoRestart, enableCors bool, dns ListOpts) (
|
||||
|
||||
func (srv *Server) SendEvent(action, id string) {
|
||||
for _, c := range srv.events {
|
||||
c <- utils.JSONMessage{Status: action, ID: id}
|
||||
c <- utils.JSONMessage{Status: action, ID: id, Time: time.Now().Unix()}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -612,9 +612,13 @@ type JSONMessage struct {
|
||||
Progress string `json:"progress,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Time int64 `json:"time,omitempty"`
|
||||
}
|
||||
|
||||
func (jm *JSONMessage) Display(out io.Writer) (error) {
|
||||
if jm.Time != 0 {
|
||||
fmt.Fprintf(out, "[%s] ", time.Unix(jm.Time, 0))
|
||||
}
|
||||
if jm.Progress != "" {
|
||||
fmt.Fprintf(out, "%s %s\r", jm.Status, jm.Progress)
|
||||
} else if jm.Error != "" {
|
||||
|
||||
Reference in New Issue
Block a user