Browse code

Revert "Planned 1.13 deprecation: email from login"

This reverts commit a66efbddb8eaa837cf42aae20b76c08274271dcf.

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
(cherry picked from commit 4bce232139014e95590db93863a8c34d3a7779cf)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>

Victor Vieux authored on 2017/03/16 02:25:36
Showing 4 changed files
... ...
@@ -35,9 +35,14 @@ func NewLoginCommand(dockerCli *command.DockerCli) *cobra.Command {
35 35
 	}
36 36
 
37 37
 	flags := cmd.Flags()
38
+
38 39
 	flags.StringVarP(&opts.user, "username", "u", "", "Username")
39 40
 	flags.StringVarP(&opts.password, "password", "p", "", "Password")
40 41
 
42
+	// Deprecated in 1.11: Should be removed in docker 17.06
43
+	flags.StringVarP(&opts.email, "email", "e", "", "Email")
44
+	flags.MarkDeprecated("email", "will be removed in 17.06.")
45
+
41 46
 	return cmd
42 47
 }
43 48
 
... ...
@@ -28,3 +28,17 @@ func (s *DockerRegistryAuthHtpasswdSuite) TestLoginToPrivateRegistry(c *check.C)
28 28
 	// now it's fine
29 29
 	dockerCmd(c, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), privateRegistryURL)
30 30
 }
31
+
32
+func (s *DockerRegistryAuthHtpasswdSuite) TestLoginToPrivateRegistryDeprecatedEmailFlag(c *check.C) {
33
+	// Test to make sure login still works with the deprecated -e and --email flags
34
+	// wrong credentials
35
+	out, _, err := dockerCmdWithError("login", "-u", s.reg.Username(), "-p", "WRONGPASSWORD", "-e", s.reg.Email(), privateRegistryURL)
36
+	c.Assert(err, checker.NotNil, check.Commentf(out))
37
+	c.Assert(out, checker.Contains, "401 Unauthorized")
38
+
39
+	// now it's fine
40
+	// -e flag
41
+	dockerCmd(c, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), "-e", s.reg.Email(), privateRegistryURL)
42
+	// --email flag
43
+	dockerCmd(c, "login", "-u", s.reg.Username(), "-p", s.reg.Password(), "--email", s.reg.Email(), privateRegistryURL)
44
+}
... ...
@@ -107,7 +107,7 @@ func (s *DockerRegistrySuite) TestUserAgentPassThrough(c *check.C) {
107 107
 	s.d.Cmd("build", "--file", dockerfileName, ".")
108 108
 	regexpCheckUA(c, buildUA)
109 109
 
110
-	s.d.Cmd("login", "-u", "richard", "-p", "testtest", loginReg.URL())
110
+	s.d.Cmd("login", "-u", "richard", "-p", "testtest", "-e", "testuser@testdomain.com", loginReg.URL())
111 111
 	regexpCheckUA(c, loginUA)
112 112
 
113 113
 	s.d.Cmd("pull", pullRepoName)
... ...
@@ -203,6 +203,11 @@ func (r *V2) Password() string {
203 203
 	return r.password
204 204
 }
205 205
 
206
+// Email returns the configured email of the server
207
+func (r *V2) Email() string {
208
+	return r.email
209
+}
210
+
206 211
 // Path returns the path where the registry write data
207 212
 func (r *V2) Path() string {
208 213
 	return filepath.Join(r.dir, "docker", "registry", "v2")