Browse code

Correct login debug log message

I noticed the following message in a daemon log:

```
attempting v2 login to registry endpoint {%!s(bool=false) https://registry:5000 v2 %!s(bool=false) %!s(bool=true) %!s(*tls.Config=&{<nil> <nil> [] map[] <nil> 0xc82075c030 [] 0 <nil> false [49196 49200 49195 49199 49162 49161 49172 49171 53 47] true false [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] <nil> 769 0 [] {{0 0} 0} {{0 0} 0 0 0 0} []})}
```

loginV2 tries to log an APIEndpoint as a string, but this struct does
not have a String method. Log the actual URL that will be used as the
endpoint, instead.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>

Aaron Lehmann authored on 2016/03/29 10:22:24
Showing 1 changed files
... ...
@@ -29,7 +29,7 @@ func loginV1(authConfig *types.AuthConfig, apiEndpoint APIEndpoint, userAgent st
29 29
 
30 30
 	serverAddress := registryEndpoint.String()
31 31
 
32
-	logrus.Debugf("attempting v1 login to registry endpoint %s", registryEndpoint)
32
+	logrus.Debugf("attempting v1 login to registry endpoint %s", serverAddress)
33 33
 
34 34
 	if serverAddress == "" {
35 35
 		return "", "", fmt.Errorf("Server Error: Server Address not set.")
... ...
@@ -103,7 +103,7 @@ func (err fallbackError) Error() string {
103 103
 // endpoint will be pinged to get authorization challenges. These challenges
104 104
 // will be used to authenticate against the registry to validate credentials.
105 105
 func loginV2(authConfig *types.AuthConfig, endpoint APIEndpoint, userAgent string) (string, string, error) {
106
-	logrus.Debugf("attempting v2 login to registry endpoint %s", endpoint)
106
+	logrus.Debugf("attempting v2 login to registry endpoint %s", strings.TrimRight(endpoint.URL.String(), "/")+"/v2/")
107 107
 
108 108
 	modifiers := DockerHeaders(userAgent, nil)
109 109
 	authTransport := transport.NewTransport(NewTransport(endpoint.TLSConfig), modifiers...)