Merge lp:~gz/goose/client_identity_refactor_fix into lp:~gophers/goose/trunk

Proposed by Martin Packman
Status: Merged
Merged at revision: 19
Proposed branch: lp:~gz/goose/client_identity_refactor_fix
Merge into: lp:~gophers/goose/trunk
Diff against target: 115 lines (+11/-11)
6 files modified
client/client.go (+4/-4)
identity/identity.go (+1/-1)
identity/legacy.go (+2/-2)
identity/legacy_test.go (+2/-2)
identity/userpass.go (+1/-1)
identity/userpass_test.go (+1/-1)
To merge this branch: bzr merge lp:~gz/goose/client_identity_refactor_fix
Reviewer Review Type Date Requested Status
John A Meinel (community) Needs Information
Dimiter Naydenov (community) Approve
Review via email: mp+135394@code.launchpad.net

Description of the change

Fixes up a couple of things from the client refactoring to get the identity service to build correctly again. This includes addressing one of the points from review about the naming of the token field.

To post a comment you must log in.
Revision history for this message
Dimiter Naydenov (dimitern) wrote :

LGTM - I suppose the build error was because Auth was expecting *Credentials, so passing &creds solved it.

review: Approve
Revision history for this message
Martin Packman (gz) wrote :

Right, only affected those tests but worth a fixup landing.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2012-11-21 16:20, Martin Packman wrote:
> Martin Packman has proposed merging
> lp:~gz/goose/client_identity_refactor_fix into lp:goose.
>
> Requested reviews: The Go Language Gophers (gophers)
>
> For more details, see:
> https://code.launchpad.net/~gz/goose/client_identity_refactor_fix/+merge/135394
>
> Fixes up a couple of things from the client refactoring to get the
> identity service to build correctly again. This includes addressing
> one of the points from review about the naming of the token field.
>

 review: needsinfo

I thought the TokenId => Token was considered controversial. So I'm
not sure if that is ready to land before we discuss it.

*I* like the change :). But I would like to have the conversation and
not sidestep Ian on it.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (Cygwin)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlCs4AEACgkQJdeBCYSNAAP7QwCeJ1oXtPHIoje/YWbo78DuRzxh
GwgAoILxZSY5eW++01DaWuBozuqY9But
=oUS9
-----END PGP SIGNATURE-----

review: Needs Information
Revision history for this message
Martin Packman (gz) wrote :

Yes, unfortunately I read Ian's response on the review comments only after making this change. Because the identity package tests still asserted on Token, rather than using the rename to TokenId brought in with client, something needed to change. Will respond to the point on the original branch review.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/client.go'
2--- client/client.go 2012-11-21 08:46:00 +0000
3+++ client/client.go 2012-11-21 12:21:20 +0000
4@@ -37,7 +37,7 @@
5
6 //TODO - store service urls by region.
7 ServiceURLs map[string]string
8- TokenId string
9+ Token string
10 TenantId string
11 UserId string
12 }
13@@ -67,7 +67,7 @@
14 return
15 }
16
17- c.TokenId = authDetails.TokenId
18+ c.Token = authDetails.Token
19 c.TenantId = authDetails.TenantId
20 c.UserId = authDetails.UserId
21 c.ServiceURLs = authDetails.ServiceURLs
22@@ -75,7 +75,7 @@
23 }
24
25 func (c *OpenStackClient) IsAuthenticated() bool {
26- return c.TokenId != ""
27+ return c.Token != ""
28 }
29
30 type Link struct {
31@@ -635,7 +635,7 @@
32 if requestData.ReqHeaders == nil {
33 requestData.ReqHeaders = make(http.Header)
34 }
35- requestData.ReqHeaders.Add("X-Auth-Token", c.TokenId)
36+ requestData.ReqHeaders.Add("X-Auth-Token", c.Token)
37 return
38 }
39
40
41=== modified file 'identity/identity.go'
42--- identity/identity.go 2012-11-21 07:56:19 +0000
43+++ identity/identity.go 2012-11-21 12:21:20 +0000
44@@ -10,7 +10,7 @@
45 )
46
47 type AuthDetails struct {
48- TokenId string
49+ Token string
50 TenantId string
51 UserId string
52 ServiceURLs map[string]string
53
54=== modified file 'identity/legacy.go'
55--- identity/legacy.go 2012-11-21 07:56:19 +0000
56+++ identity/legacy.go 2012-11-21 12:21:20 +0000
57@@ -31,8 +31,8 @@
58 response.StatusCode, response.Status, content)
59 }
60 details := &AuthDetails{}
61- details.TokenId = response.Header.Get("X-Auth-Token")
62- if details.TokenId == "" {
63+ details.Token = response.Header.Get("X-Auth-Token")
64+ if details.Token == "" {
65 return nil, fmt.Errorf("Did not get valid Token from auth request")
66 }
67 nova_url := response.Header.Get("X-Server-Management-Url")
68
69=== modified file 'identity/legacy_test.go'
70--- identity/legacy_test.go 2012-11-11 11:13:52 +0000
71+++ identity/legacy_test.go 2012-11-21 12:21:20 +0000
72@@ -19,7 +19,7 @@
73 service.SetManagementURL("http://management/url")
74 var l Authenticator = &Legacy{}
75 creds := Credentials{User: "joe-user", URL: s.Server.URL, Secrets: "secrets"}
76- auth, err := l.Auth(creds)
77+ auth, err := l.Auth(&creds)
78 c.Assert(err, IsNil)
79 c.Assert(auth.Token, Equals, token)
80 c.Assert(auth.ServiceURLs, DeepEquals, map[string]string{"compute": "http://management/url"})
81@@ -31,7 +31,7 @@
82 _ = service.AddUser("joe-user", "secrets")
83 var l Authenticator = &Legacy{}
84 creds := Credentials{User: "joe-user", URL: s.Server.URL, Secrets: "bad-secrets"}
85- auth, err := l.Auth(creds)
86+ auth, err := l.Auth(&creds)
87 c.Assert(err, NotNil)
88 c.Assert(auth, IsNil)
89 }
90
91=== modified file 'identity/userpass.go'
92--- identity/userpass.go 2012-11-21 08:46:00 +0000
93+++ identity/userpass.go 2012-11-21 12:21:20 +0000
94@@ -94,7 +94,7 @@
95 if respToken.Id == "" {
96 return nil, fmt.Errorf("Did not get valid Token from auth request")
97 }
98- details.TokenId = respToken.Id
99+ details.Token = respToken.Id
100 details.TenantId = respToken.Tenant.Id
101 details.UserId = access.User.Id
102 details.ServiceURLs = make(map[string]string, len(access.ServiceCatalog))
103
104=== modified file 'identity/userpass_test.go'
105--- identity/userpass_test.go 2012-11-11 11:13:52 +0000
106+++ identity/userpass_test.go 2012-11-21 12:21:20 +0000
107@@ -18,7 +18,7 @@
108 token := service.AddUser("joe-user", "secrets")
109 var l Authenticator = &UserPass{}
110 creds := Credentials{User: "joe-user", URL: s.Server.URL, Secrets: "secrets"}
111- auth, err := l.Auth(creds)
112+ auth, err := l.Auth(&creds)
113 c.Assert(err, IsNil)
114 c.Assert(auth.Token, Equals, token)
115 // c.Assert(auth.ServiceURLs, DeepEquals, map[string]string{"compute": "http://management/url"})

Subscribers

People subscribed via source and target branches