Преглед изворни кода

Re-enabled CmdPull progress bar code which had been temporarily disabled

Solomon Hykes пре 12 година
родитељ
комит
5675439b91
1 измењених фајлова са 15 додато и 15 уклоњено
  1. 15 15
      server/server.go

+ 15 - 15
server/server.go

@@ -11,7 +11,7 @@ import (
 	"github.com/dotcloud/docker/image"
 	"github.com/dotcloud/docker/image"
 	"github.com/dotcloud/docker/rcli"
 	"github.com/dotcloud/docker/rcli"
 	"io"
 	"io"
-	// "net/http"
+	"net/http"
 	"net/url"
 	"net/url"
 	"os"
 	"os"
 	"path"
 	"path"
@@ -393,20 +393,20 @@ func (srv *Server) CmdPull(stdin io.ReadCloser, stdout io.Writer, args ...string
 	fmt.Fprintf(stdout, "Downloading from %s\n", u.String())
 	fmt.Fprintf(stdout, "Downloading from %s\n", u.String())
 	// Download with curl (pretty progress bar)
 	// Download with curl (pretty progress bar)
 	// If curl is not available, fallback to http.Get()
 	// If curl is not available, fallback to http.Get()
-	// archive, err := future.Curl(u.String(), stdout)
-	// if err != nil {
-	// 	if resp, err := http.Get(u.String()); err != nil {
-	// 		return err
-	// 	} else {
-	// 		archive = resp.Body
-	// 	}
-	// }
-	// fmt.Fprintf(stdout, "Unpacking to %s\n", name)
-	// img, err := srv.images.Import(name, archive, nil)
-	// if err != nil {
-	// 	return err
-	// }
-	// fmt.Fprintln(stdout, img.Id)
+	archive, err := future.Curl(u.String(), stdout)
+	if err != nil {
+		if resp, err := http.Get(u.String()); err != nil {
+			return err
+		} else {
+			archive = resp.Body
+		}
+	}
+	fmt.Fprintf(stdout, "Unpacking to %s\n", name)
+	img, err := srv.images.Import(name, archive, nil)
+	if err != nil {
+		return err
+	}
+	fmt.Fprintln(stdout, img.Id)
 	return nil
 	return nil
 }
 }