Merge lp:~allenap/gwacl/remove-role-endpoints-2 into lp:gwacl

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 204
Merged at revision: 203
Proposed branch: lp:~allenap/gwacl/remove-role-endpoints-2
Merge into: lp:gwacl
Diff against target: 69 lines (+4/-16)
2 files modified
example/management/run.go (+3/-9)
x509dispatcher.go (+1/-7)
To merge this branch: bzr merge lp:~allenap/gwacl/remove-role-endpoints-2
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+177065@code.launchpad.net

Commit message

Niceties missed from the main remove-role-endpoints branch.

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

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

 review: approve

Approved but I'm interested to know why you changed a couple of things!

> defer func() { Info("Removing role input endpoint...") - //
> FIXME: Something above - AddRoleEndpoints seems a prime suspect - -
> // causes Azure to do something asynchronously, which we must wait
> for - // before attempting this call, or it will blow up
> with a 409.

Was this fixed previously then? Or was it not a problem?

> -func newX509Response() *x509Response { - return &x509Response{
> - Body: make([]byte, 0), - } -} -
[snip]
> - response := newX509Response() + response :=
> &x509Response{} response.StatusCode = httpResponse.StatusCode
> response.Body, err = ioutil.ReadAll(httpResponse.Body) if err !=
> nil {
>

This is removing a make() on the Body - is that right/ok? Go still
leaves me wondering whether it has changed the semantics when you
assign to Body in the second-last line here ... :/

Cheers.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHx4mAACgkQWhGlTF8G/HdkIwCgpzEEtzP+ZKpCNC68JEo9+a9t
1csAn1YEXFNDv2Dx/Iz3qoUbMJP2Jnc2
=IDOH
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Julian Edwards (julian-edwards) wrote :

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

Sigh @ whatever screwed up formatting on the code quote parts.
/me stares at Thunderbird
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlHx42IACgkQWhGlTF8G/Hd6cQCgpixY0qeaTOaxUy1wiX/lcm79
vWEAoKWUMqX4a/BMOQu7BuisM8yykVXd
=xBSW
-----END PGP SIGNATURE-----

Revision history for this message
Gavin Panella (allenap) wrote :

>> defer func() { Info("Removing role input endpoint...") - //
>> FIXME: Something above - AddRoleEndpoints seems a prime suspect - -
>> // causes Azure to do something asynchronously, which we must wait
>> for - // before attempting this call, or it will blow up
>> with a 409.
>
> Was this fixed previously then? Or was it not a problem?

I added this in my previous branch, but also fixed it there and forgot
to remove this message.

>
>> -func newX509Response() *x509Response { - return &x509Response{
>> - Body: make([]byte, 0), - } -} -
> [snip]
>> - response := newX509Response() + response :=
>> &x509Response{} response.StatusCode = httpResponse.StatusCode
>> response.Body, err = ioutil.ReadAll(httpResponse.Body) if err !=
>> nil {
>>
>
> This is removing a make() on the Body - is that right/ok? Go still
> leaves me wondering whether it has changed the semantics when you
> assign to Body in the second-last line here ... :/

Yeah, it's not needed. The zero value for x509Response.Body is an
empty slice.

Thanks for the review!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'example/management/run.go'
--- example/management/run.go 2013-07-25 21:07:12 +0000
+++ example/management/run.go 2013-07-25 22:26:30 +0000
@@ -76,9 +76,6 @@
76 api, err := gwacl.NewManagementAPI(subscriptionID, certFile)76 api, err := gwacl.NewManagementAPI(subscriptionID, certFile)
77 checkError(err)77 checkError(err)
7878
79 // Exercise the API.
80
81 // Exercise hosted services API.
82 ExerciseHostedServicesAPI(api)79 ExerciseHostedServicesAPI(api)
8380
84 Info("All done.")81 Info("All done.")
@@ -172,7 +169,7 @@
172 deployments, err := api.ListAllDeployments(&gwacl.ListAllDeploymentsRequest{ServiceName: hostedService.ServiceName})169 deployments, err := api.ListAllDeployments(&gwacl.ListAllDeploymentsRequest{ServiceName: hostedService.ServiceName})
173 checkError(err)170 checkError(err)
174 if len(deployments) != len(detailedHostedService.Deployments) {171 if len(deployments) != len(detailedHostedService.Deployments) {
175 Infof(172 Errorf(
176 "Mismatch in reported deployments: %d != %d",173 "Mismatch in reported deployments: %d != %d",
177 len(deployments), len(detailedHostedService.Deployments))174 len(deployments), len(detailedHostedService.Deployments))
178 }175 }
@@ -260,9 +257,6 @@
260257
261 defer func() {258 defer func() {
262 Info("Removing role input endpoint...")259 Info("Removing role input endpoint...")
263 // FIXME: Something above - AddRoleEndpoints seems a prime suspect -
264 // causes Azure to do something asynchronously, which we must wait for
265 // before attempting this call, or it will blow up with a 409.
266 err := api.RemoveRoleEndpoints(&gwacl.RemoveRoleEndpointsRequest{260 err := api.RemoveRoleEndpoints(&gwacl.RemoveRoleEndpointsRequest{
267 ServiceName: hostServiceName,261 ServiceName: hostServiceName,
268 DeploymentName: deployment.Name,262 DeploymentName: deployment.Name,
@@ -275,8 +269,8 @@
275269
276 if pause {270 if pause {
277 var wait string271 var wait string
278 Info("Pausing so you can play with the newly-created VM")272 fmt.Println("Pausing so you can play with the newly-created VM")
279 Info("To clear up, type something and press enter to continue")273 fmt.Println("To clear up, type something and press enter to continue")
280 fmt.Scan(&wait)274 fmt.Scan(&wait)
281 }275 }
282}276}
283277
=== modified file 'x509dispatcher.go'
--- x509dispatcher.go 2013-07-25 17:31:17 +0000
+++ x509dispatcher.go 2013-07-25 22:26:30 +0000
@@ -65,12 +65,6 @@
65 Header http.Header65 Header http.Header
66}66}
6767
68func newX509Response() *x509Response {
69 return &x509Response{
70 Body: make([]byte, 0),
71 }
72}
73
74func performX509Request(session *x509Session, request *X509Request) (*x509Response, error) {68func performX509Request(session *x509Session, request *X509Request) (*x509Response, error) {
75 Debugf("Request: %s %s", request.Method, request.URL)69 Debugf("Request: %s %s", request.Method, request.URL)
76 if len(request.Payload) > 0 {70 if len(request.Payload) > 0 {
@@ -89,7 +83,7 @@
89 return nil, err83 return nil, err
90 }84 }
9185
92 response := newX509Response()86 response := &x509Response{}
93 response.StatusCode = httpResponse.StatusCode87 response.StatusCode = httpResponse.StatusCode
94 response.Body, err = ioutil.ReadAll(httpResponse.Body)88 response.Body, err = ioutil.ReadAll(httpResponse.Body)
95 if err != nil {89 if err != nil {

Subscribers

People subscribed via source and target branches

to all changes: