From 0b2167b3b8ffa80234b708470318e82f1f7ce740 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 4 Jun 2013 16:09:08 +0000 Subject: [PATCH] fix progress message in client Upstream-commit: 3922691fb99a99cec0a5d239da522cc3d8778e6c Component: engine --- components/engine/commands.go | 2 +- components/engine/docs/sources/api/docker_remote_api.rst | 6 +++--- components/engine/server.go | 2 +- components/engine/utils/utils.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/engine/commands.go b/components/engine/commands.go index c38c18a04c..93bae63a29 100644 --- a/components/engine/commands.go +++ b/components/engine/commands.go @@ -1379,7 +1379,7 @@ func (cli *DockerCli) stream(method, path string, in io.Reader, out io.Writer) e return err } if m.Progress != "" { - fmt.Fprintf(out, "Downloading %s\r", m.Progress) + fmt.Fprintf(out, "%s %s\r", m.Status, m.Progress) } else if m.Error != "" { return fmt.Errorf(m.Error) } else { diff --git a/components/engine/docs/sources/api/docker_remote_api.rst b/components/engine/docs/sources/api/docker_remote_api.rst index dca4599c55..1c46cf148a 100644 --- a/components/engine/docs/sources/api/docker_remote_api.rst +++ b/components/engine/docs/sources/api/docker_remote_api.rst @@ -564,7 +564,7 @@ Create an image Content-Type: application/json {"status":"Pulling..."} - {"progress":"1/? (n/a)"} + {"status":"Pulling", "progress":"1/? (n/a)"} {"error":"Invalid..."} ... @@ -607,7 +607,7 @@ Insert a file in a image Content-Type: application/json {"status":"Inserting..."} - {"progress":"1/? (n/a)"} + {"status":"Inserting", "progress":"1/? (n/a)"} {"error":"Invalid..."} ... @@ -734,7 +734,7 @@ Push an image on the registry Content-Type: application/json {"status":"Pushing..."} - {"progress":"1/? (n/a)"} + {"status":"Pushing", "progress":"1/? (n/a)"} {"error":"Invalid..."} ... diff --git a/components/engine/server.go b/components/engine/server.go index 08cb37a72e..ec2157d803 100644 --- a/components/engine/server.go +++ b/components/engine/server.go @@ -573,7 +573,7 @@ func (srv *Server) pushImage(r *registry.Registry, out io.Writer, remote, imgId, } // Send the layer - if err := r.PushImageLayerRegistry(imgData.Id, utils.ProgressReader(layerData, int(layerData.Size), out, sf.FormatProgress("", "%v/%v (%v)"), sf), ep, token); err != nil { + if err := r.PushImageLayerRegistry(imgData.Id, utils.ProgressReader(layerData, int(layerData.Size), out, sf.FormatProgress("Pushing", "%v/%v (%v)"), sf), ep, token); err != nil { return err } return nil diff --git a/components/engine/utils/utils.go b/components/engine/utils/utils.go index 33aa2eba8c..2cd23ad6d2 100644 --- a/components/engine/utils/utils.go +++ b/components/engine/utils/utils.go @@ -608,7 +608,7 @@ func (sf *StreamFormatter) FormatError(err error) []byte { func (sf *StreamFormatter) FormatProgress(action, str string) []byte { sf.used = true if sf.json { - b, err := json.Marshal(&JsonMessage{Progress:str}) + b, err := json.Marshal(&JsonMessage{Status: action, Progress:str}) if err != nil { return nil }