Browse code

client: Rip out HTTP check from docker version

For background to this change please see:
https://github.com/dotcloud/docker/issues/4802
https://github.com/dotcloud/docker/pull/5670

Docker-DCO-1.1-Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com> (github: jmccrohan)

Jonathan McCrohan authored on 2014/05/18 10:00:53
Showing 3 changed files
... ...
@@ -387,14 +387,6 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
387 387
 	}
388 388
 	fmt.Fprintf(cli.out, "Go version (server): %s\n", remoteVersion.Get("GoVersion"))
389 389
 	fmt.Fprintf(cli.out, "Git commit (server): %s\n", remoteVersion.Get("GitCommit"))
390
-	release := utils.GetReleaseVersion()
391
-	if release != "" {
392
-		fmt.Fprintf(cli.out, "Last stable version: %s", release)
393
-		if (dockerversion.VERSION != "" || remoteVersion.Exists("Version")) && (strings.Trim(dockerversion.VERSION, "-dev") != release || strings.Trim(remoteVersion.Get("Version"), "-dev") != release) {
394
-			fmt.Fprintf(cli.out, ", please update docker")
395
-		}
396
-		fmt.Fprintf(cli.out, "\n")
397
-	}
398 390
 	return nil
399 391
 }
400 392
 
... ...
@@ -26,7 +26,6 @@ func TestVersionEnsureSucceeds(t *testing.T) {
26 26
 		"Server API version:",
27 27
 		"Go version (server):",
28 28
 		"Git commit (server):",
29
-		"Last stable version:",
30 29
 	}
31 30
 
32 31
 	for _, linePrefix := range stringsToCheck {
... ...
@@ -821,22 +821,6 @@ func ParseHost(defaultHost string, defaultUnix, addr string) (string, error) {
821 821
 	return fmt.Sprintf("%s://%s:%d", proto, host, port), nil
822 822
 }
823 823
 
824
-func GetReleaseVersion() string {
825
-	resp, err := http.Get("https://get.docker.io/latest")
826
-	if err != nil {
827
-		return ""
828
-	}
829
-	defer resp.Body.Close()
830
-	if resp.ContentLength > 24 || resp.StatusCode != 200 {
831
-		return ""
832
-	}
833
-	body, err := ioutil.ReadAll(resp.Body)
834
-	if err != nil {
835
-		return ""
836
-	}
837
-	return strings.TrimSpace(string(body))
838
-}
839
-
840 824
 // Get a repos name and returns the right reposName + tag
841 825
 // The tag can be confusing because of a port in a repository name.
842 826
 //     Ex: localhost.localdomain:5000/samalba/hipache:latest