Browse code

fix progress message in client

Victor Vieux authored on 2013/06/05 01:09:08
Showing 4 changed files
... ...
@@ -1379,7 +1379,7 @@ func (cli *DockerCli) stream(method, path string, in io.Reader, out io.Writer) e
1379 1379
 				return err
1380 1380
 			}
1381 1381
 			if m.Progress != "" {
1382
-				fmt.Fprintf(out, "Downloading %s\r", m.Progress)
1382
+				fmt.Fprintf(out, "%s %s\r", m.Status, m.Progress)
1383 1383
 			} else if m.Error != "" {
1384 1384
 				return fmt.Errorf(m.Error)
1385 1385
 			} else {
... ...
@@ -564,7 +564,7 @@ Create an image
564 564
 	   Content-Type: application/json
565 565
 
566 566
 	   {"status":"Pulling..."}
567
-	   {"progress":"1/? (n/a)"}
567
+	   {"status":"Pulling", "progress":"1/? (n/a)"}
568 568
 	   {"error":"Invalid..."}
569 569
 	   ...
570 570
 
... ...
@@ -607,7 +607,7 @@ Insert a file in a image
607 607
 	   Content-Type: application/json
608 608
 
609 609
 	   {"status":"Inserting..."}
610
-	   {"progress":"1/? (n/a)"}
610
+	   {"status":"Inserting", "progress":"1/? (n/a)"}
611 611
 	   {"error":"Invalid..."}
612 612
 	   ...
613 613
 
... ...
@@ -734,7 +734,7 @@ Push an image on the registry
734 734
 	   Content-Type: application/json
735 735
 
736 736
 	   {"status":"Pushing..."}
737
-	   {"progress":"1/? (n/a)"}
737
+	   {"status":"Pushing", "progress":"1/? (n/a)"}
738 738
 	   {"error":"Invalid..."}
739 739
 	   ...
740 740
 
... ...
@@ -573,7 +573,7 @@ func (srv *Server) pushImage(r *registry.Registry, out io.Writer, remote, imgId,
573 573
 	}
574 574
 
575 575
 	// Send the layer
576
-	if err := r.PushImageLayerRegistry(imgData.Id, utils.ProgressReader(layerData, int(layerData.Size), out, sf.FormatProgress("", "%v/%v (%v)"), sf), ep, token); err != nil {
576
+	if err := r.PushImageLayerRegistry(imgData.Id, utils.ProgressReader(layerData, int(layerData.Size), out, sf.FormatProgress("Pushing", "%v/%v (%v)"), sf), ep, token); err != nil {
577 577
 		return err
578 578
 	}
579 579
 	return nil
... ...
@@ -608,7 +608,7 @@ func (sf *StreamFormatter) FormatError(err error) []byte {
608 608
 func (sf *StreamFormatter) FormatProgress(action, str string) []byte {
609 609
 	sf.used = true
610 610
 	if sf.json {
611
-		b, err := json.Marshal(&JsonMessage{Progress:str})
611
+		b, err := json.Marshal(&JsonMessage{Status: action, Progress:str})
612 612
 		if err != nil {
613 613
                         return nil
614 614
                 }