From 1e2ef274cdaa76e79435df52cdc196739ba8b3b1 Mon Sep 17 00:00:00 2001 From: Marco Hennings Date: Thu, 4 Jul 2013 10:50:37 +0200 Subject: [PATCH] Pushing an Image causes the docker client to give an error message instead of writing out streamed status. This is caused by a Buffering message that is not in the correct json format: [...] {"status" :"Pushing 6bba11a28f1ca247de9a47071355ce5923a45b8fea3182389f992f4 24b93edae"}Buffering to disk 244/? (n/a).. {"status":"Pushing",[...] The "Buffering to disk" message is originated in srv.runtime.graph.TempLayerArchive I am now using the StreamFormatter provided by the context from which the method is called. --- graph.go | 3 +-- server.go | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/graph.go b/graph.go index 0bf7eccdbe..1417aade0d 100644 --- a/graph.go +++ b/graph.go @@ -162,7 +162,7 @@ func (graph *Graph) Register(layerData Archive, store bool, img *Image) error { // The archive is stored on disk and will be automatically deleted as soon as has been read. // If output is not nil, a human-readable progress bar will be written to it. // FIXME: does this belong in Graph? How about MktempFile, let the caller use it for archives? -func (graph *Graph) TempLayerArchive(id string, compression Compression, output io.Writer) (*TempArchive, error) { +func (graph *Graph) TempLayerArchive(id string, compression Compression, sf *utils.StreamFormatter, output io.Writer) (*TempArchive, error) { image, err := graph.Get(id) if err != nil { return nil, err @@ -175,7 +175,6 @@ func (graph *Graph) TempLayerArchive(id string, compression Compression, output if err != nil { return nil, err } - sf := utils.NewStreamFormatter(false) return NewTempArchive(utils.ProgressReader(ioutil.NopCloser(archive), 0, output, sf.FormatProgress("Buffering to disk", "%v/%v (%v)"), sf), tmp.Root) } diff --git a/server.go b/server.go index 4e30ad6c5d..a217cf7d82 100644 --- a/server.go +++ b/server.go @@ -684,7 +684,7 @@ func (srv *Server) pushImage(r *registry.Registry, out io.Writer, remote, imgID, if err != nil { if os.IsNotExist(err) { // If the archive does not exist, create one from the layer - layerData, err = srv.runtime.graph.TempLayerArchive(imgID, Xz, out) + layerData, err = srv.runtime.graph.TempLayerArchive(imgID, Xz, sf, out) if err != nil { return fmt.Errorf("Failed to generate layer archive: %s", err) }