Merge lp:~wallyworld/gwacl/azure-management-api-change into lp:gwacl

Proposed by Ian Booth
Status: Merged
Approved by: Ian Booth
Approved revision: 230
Merged at revision: 227
Proposed branch: lp:~wallyworld/gwacl/azure-management-api-change
Merge into: lp:gwacl
Diff against target: 410 lines (+54/-50)
4 files modified
management_base.go (+22/-18)
management_base_test.go (+30/-30)
xmlobjects.go (+1/-1)
xmlobjects_test.go (+1/-1)
To merge this branch: bzr merge lp:~wallyworld/gwacl/azure-management-api-change
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+193368@code.launchpad.net

Commit message

Azure now requires certain requests to the management api to have an updated version number in the header. Such changes are supposed to be backwards compatible but msft failed not to break existing applications. This branch includes the new api version. It also base64 encodes customdata sent with the request, as this also appears to have changed from underneath us.

With these changes, juju bootstrap now completes and the bootstrap instance spins up. Previously it would have errored part way through bootstrap. There still may be an issue with cloud-init completing properly but if this is the case, it appears to be a separate issue and I'd like to land this branch to allow others with Azure credentials to help debug.

Description of the change

Azure now requires certain requests to the management api to have an updated version number in the header. Such changes are supposed to be backwards compatible but msft failed not to break existing applications. This branch includes the new api version. It also base64 encodes customdata sent with the request, as this also appears to have changed from underneath us.

With these changes, juju bootstrap now completes and the bootstrap instance spins up. Previously it would have errored part way through bootstrap. There still may be an issue with cloud-init completing properly but if this is the case, it appears to be a separate issue and I'd like to land this branch to allow others with Azure credentials to help debug.

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

<bigjools> wallyworld_: first comment - pease remove the factored version numbers
<wallyworld_> why?
<bigjools> I previously had someone stop doing that - each api request is separately versioned and if you factor it you will introduce subtle bugs
<wallyworld_> it kinda sucks having them all copied and pasted in the code
<bigjools> yes - but it needs to be done
<wallyworld_> ok then
<bigjools> I rooted out at least 3 bugs last time I unfactored it

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

453 - customdata := MakeRandomString(10)
454 + customdata := "customdata"
455 + base64EncodedCustomData := "Y3VzdG9tZGF0YQ=="

I'd feel better if you kept this random and calculated the expected base64 encoding.

Everything else looks cool.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'management_base.go'
--- management_base.go 2013-08-09 14:59:50 +0000
+++ management_base.go 2013-10-31 04:14:10 +0000
@@ -11,6 +11,10 @@
11 "time"11 "time"
12)12)
1313
14// Note: each API call is required to include a version string in the request header.
15// These may often be the same string, but need to be kept as strings rather than being
16// pulled out and replaced with a constant, each API call may be individually changed.
17
14type ManagementAPI struct {18type ManagementAPI struct {
15 session *x509Session19 session *x509Session
16 // The interval used when polling the server.20 // The interval used when polling the server.
@@ -124,7 +128,7 @@
124// HostedService objects.128// HostedService objects.
125// See http://msdn.microsoft.com/en-us/library/windowsazure/ee460781.aspx129// See http://msdn.microsoft.com/en-us/library/windowsazure/ee460781.aspx
126func (api *ManagementAPI) ListHostedServices() ([]HostedServiceDescriptor, error) {130func (api *ManagementAPI) ListHostedServices() ([]HostedServiceDescriptor, error) {
127 res, err := api.session.get("services/hostedservices", "2012-03-01")131 res, err := api.session.get("services/hostedservices", "2013-10-01")
128 if err != nil {132 if err != nil {
129 return nil, err133 return nil, err
130 }134 }
@@ -144,7 +148,7 @@
144 if err != nil {148 if err != nil {
145 return err149 return err
146 }150 }
147 response, err := api.session.put(URI, "2012-03-01", []byte(body), "application/xml")151 response, err := api.session.put(URI, "2013-10-01", []byte(body), "application/xml")
148 if err != nil {152 if err != nil {
149 return err153 return err
150 }154 }
@@ -155,7 +159,7 @@
155// management API.159// management API.
156// See http://msdn.microsoft.com/en-us/library/windowsazure/ee460806.aspx160// See http://msdn.microsoft.com/en-us/library/windowsazure/ee460806.aspx
157func (api *ManagementAPI) GetHostedServiceProperties(161func (api *ManagementAPI) GetHostedServiceProperties(
158 serviceName string, embedDetail bool) (*HostedService, error) {162serviceName string, embedDetail bool) (*HostedService, error) {
159 checkPathComponents(serviceName)163 checkPathComponents(serviceName)
160 URI := "services/hostedservices/" + serviceName + "?embed-detail="164 URI := "services/hostedservices/" + serviceName + "?embed-detail="
161 switch embedDetail {165 switch embedDetail {
@@ -164,7 +168,7 @@
164 case false:168 case false:
165 URI += "false"169 URI += "false"
166 }170 }
167 res, err := api.session.get(URI, "2012-03-01")171 res, err := api.session.get(URI, "2013-10-01")
168 if err != nil {172 if err != nil {
169 return nil, err173 return nil, err
170 }174 }
@@ -184,7 +188,7 @@
184 if err != nil {188 if err != nil {
185 return err189 return err
186 }190 }
187 response, err := api.session.post(URI, "2012-03-01", []byte(body), "application/xml")191 response, err := api.session.post(URI, "2013-10-01", []byte(body), "application/xml")
188 if err != nil {192 if err != nil {
189 return err193 return err
190 }194 }
@@ -199,7 +203,7 @@
199func (api *ManagementAPI) CheckHostedServiceNameAvailability(name string) error {203func (api *ManagementAPI) CheckHostedServiceNameAvailability(name string) error {
200 var err error204 var err error
201 response, err := api.session.get(205 response, err := api.session.get(
202 "services/hostedservices/operations/isavailable/"+name, "2012-03-01")206 "services/hostedservices/operations/isavailable/"+name, "2013-10-01")
203 if err != nil {207 if err != nil {
204 return err208 return err
205 }209 }
@@ -240,7 +244,7 @@
240 if err != nil {244 if err != nil {
241 return err245 return err
242 }246 }
243 response, err := api.session.post(URI, "2012-03-01", []byte(body), "application/xml")247 response, err := api.session.post(URI, "2013-10-01", []byte(body), "application/xml")
244 if err != nil {248 if err != nil {
245 return err249 return err
246 }250 }
@@ -251,7 +255,7 @@
251// See http://msdn.microsoft.com/en-us/library/windowsazure/ee460815.aspx255// See http://msdn.microsoft.com/en-us/library/windowsazure/ee460815.aspx
252func (api *ManagementAPI) DeleteDeployment(serviceName string, deploymentName string) error {256func (api *ManagementAPI) DeleteDeployment(serviceName string, deploymentName string) error {
253 path := "services/hostedservices/" + serviceName + "/deployments/" + deploymentName257 path := "services/hostedservices/" + serviceName + "/deployments/" + deploymentName
254 response, err := api.session.delete(path, "2012-03-01")258 response, err := api.session.delete(path, "2013-10-01")
255 if err != nil {259 if err != nil {
256 if IsNotFoundError(err) {260 if IsNotFoundError(err) {
257 return nil261 return nil
@@ -273,7 +277,7 @@
273 checkPathComponents(request.ServiceName)277 checkPathComponents(request.ServiceName)
274 checkPathComponents(request.DeploymentName)278 checkPathComponents(request.DeploymentName)
275 path := "services/hostedservices/" + request.ServiceName + "/deployments/" + request.DeploymentName279 path := "services/hostedservices/" + request.ServiceName + "/deployments/" + request.DeploymentName
276 response, err := api.session.get(path, "2012-03-01")280 response, err := api.session.get(path, "2013-10-01")
277 if err != nil {281 if err != nil {
278 return nil, err282 return nil, err
279 }283 }
@@ -298,7 +302,7 @@
298 if err != nil {302 if err != nil {
299 return err303 return err
300 }304 }
301 response, err := api.session.post(uri, "2012-03-01", []byte(body), "application/xml")305 response, err := api.session.post(uri, "2013-10-01", []byte(body), "application/xml")
302 if err != nil {306 if err != nil {
303 return err307 return err
304 }308 }
@@ -395,7 +399,7 @@
395func (api *ManagementAPI) StartRole(request *StartRoleRequest) error {399func (api *ManagementAPI) StartRole(request *StartRoleRequest) error {
396 return api.performRoleOperation(400 return api.performRoleOperation(
397 request.ServiceName, request.DeploymentName, request.RoleName,401 request.ServiceName, request.DeploymentName, request.RoleName,
398 "2012-03-01", startRoleOperation)402 "2013-10-01", startRoleOperation)
399}403}
400404
401type RestartRoleRequest performRoleOperationRequest405type RestartRoleRequest performRoleOperationRequest
@@ -405,7 +409,7 @@
405func (api *ManagementAPI) RestartRole(request *RestartRoleRequest) error {409func (api *ManagementAPI) RestartRole(request *RestartRoleRequest) error {
406 return api.performRoleOperation(410 return api.performRoleOperation(
407 request.ServiceName, request.DeploymentName, request.RoleName,411 request.ServiceName, request.DeploymentName, request.RoleName,
408 "2012-03-01", restartRoleOperation)412 "2013-10-01", restartRoleOperation)
409}413}
410414
411type ShutdownRoleRequest performRoleOperationRequest415type ShutdownRoleRequest performRoleOperationRequest
@@ -415,7 +419,7 @@
415func (api *ManagementAPI) ShutdownRole(request *ShutdownRoleRequest) error {419func (api *ManagementAPI) ShutdownRole(request *ShutdownRoleRequest) error {
416 return api.performRoleOperation(420 return api.performRoleOperation(
417 request.ServiceName, request.DeploymentName, request.RoleName,421 request.ServiceName, request.DeploymentName, request.RoleName,
418 "2012-03-01", shutdownRoleOperation)422 "2013-10-01", shutdownRoleOperation)
419}423}
420424
421type GetRoleRequest performRoleOperationRequest425type GetRoleRequest performRoleOperationRequest
@@ -428,7 +432,7 @@
428 url := ("services/hostedservices/" + request.ServiceName +432 url := ("services/hostedservices/" + request.ServiceName +
429 "/deployments/" + request.DeploymentName + "/roles/" +433 "/deployments/" + request.DeploymentName + "/roles/" +
430 request.RoleName)434 request.RoleName)
431 response, err := api.session.get(url, "2012-03-01")435 response, err := api.session.get(url, "2013-10-01")
432 if err != nil {436 if err != nil {
433 return nil, err437 return nil, err
434 }438 }
@@ -463,7 +467,7 @@
463 if err != nil {467 if err != nil {
464 return err468 return err
465 }469 }
466 response, err := api.session.put(url, "2012-03-01", []byte(role), "application/xml")470 response, err := api.session.put(url, "2013-10-01", []byte(role), "application/xml")
467 if err != nil {471 if err != nil {
468 return err472 return err
469 }473 }
@@ -483,7 +487,7 @@
483 if err != nil {487 if err != nil {
484 return err488 return err
485 }489 }
486 response, err := api.session.post(url, "2012-03-01", []byte(body), "application/xml")490 response, err := api.session.post(url, "2013-10-01", []byte(body), "application/xml")
487 if err != nil {491 if err != nil {
488 return err492 return err
489 }493 }
@@ -536,7 +540,7 @@
536// be nil.540// be nil.
537// See http://msdn.microsoft.com/en-us/library/windowsazure/jj157196.aspx541// See http://msdn.microsoft.com/en-us/library/windowsazure/jj157196.aspx
538func (api *ManagementAPI) GetNetworkConfiguration() (*NetworkConfiguration, error) {542func (api *ManagementAPI) GetNetworkConfiguration() (*NetworkConfiguration, error) {
539 response, err := api.session.get("services/networking/media", "2012-03-01")543 response, err := api.session.get("services/networking/media", "2013-10-01")
540 if err != nil {544 if err != nil {
541 if IsNotFoundError(err) {545 if IsNotFoundError(err) {
542 return nil, nil546 return nil, nil
@@ -561,7 +565,7 @@
561 return err565 return err
562 }566 }
563 response, err := api.session.put(567 response, err := api.session.put(
564 "services/networking/media", "2012-03-01", []byte(body),568 "services/networking/media", "2013-10-01", []byte(body),
565 "application/octet-stream")569 "application/octet-stream")
566 if err != nil {570 if err != nil {
567 return err571 return err
568572
=== modified file 'management_base_test.go'
--- management_base_test.go 2013-08-28 00:13:04 +0000
+++ management_base_test.go 2013-10-31 04:14:10 +0000
@@ -412,7 +412,7 @@
412412
413 c.Assert(err, IsNil)413 c.Assert(err, IsNil)
414 expectedURL := defaultManagement + api.session.subscriptionId + "/services/hostedservices"414 expectedURL := defaultManagement + api.session.subscriptionId + "/services/hostedservices"
415 checkOneRequest(c, &recordedRequests, expectedURL, "2012-03-01", nil, "GET")415 checkOneRequest(c, &recordedRequests, expectedURL, "2013-10-01", nil, "GET")
416 c.Assert(descriptors[0].URL, Equals, url)416 c.Assert(descriptors[0].URL, Equals, url)
417}417}
418418
@@ -442,7 +442,7 @@
442442
443 c.Assert(err, IsNil)443 c.Assert(err, IsNil)
444 expectedURL := defaultManagement + api.session.subscriptionId + "/services/hostedservices/" + serviceName444 expectedURL := defaultManagement + api.session.subscriptionId + "/services/hostedservices/" + serviceName
445 checkOneRequest(c, &recordedRequests, expectedURL, "2012-03-01", requestPayload, "PUT")445 checkOneRequest(c, &recordedRequests, expectedURL, "2013-10-01", requestPayload, "PUT")
446}446}
447447
448func assertGetHostedServicePropertiesRequest(c *C, api *ManagementAPI, serviceName string, embedDetail bool, httpRequest *X509Request) {448func assertGetHostedServicePropertiesRequest(c *C, api *ManagementAPI, serviceName string, embedDetail bool, httpRequest *X509Request) {
@@ -454,7 +454,7 @@
454 }454 }
455 expectedURL := fmt.Sprintf("%s%s/services/hostedservices/%s?%s", defaultManagement,455 expectedURL := fmt.Sprintf("%s%s/services/hostedservices/%s?%s", defaultManagement,
456 api.session.subscriptionId, serviceName, query)456 api.session.subscriptionId, serviceName, query)
457 checkRequest(c, httpRequest, expectedURL, "2012-03-01", nil, "GET")457 checkRequest(c, httpRequest, expectedURL, "2013-10-01", nil, "GET")
458}458}
459459
460func (suite *managementBaseAPISuite) TestGetHostedServiceProperties_withoutDetails(c *C) {460func (suite *managementBaseAPISuite) TestGetHostedServiceProperties_withoutDetails(c *C) {
@@ -563,7 +563,7 @@
563 expectedURL := defaultManagement + api.session.subscriptionId + "/services/hostedservices"563 expectedURL := defaultManagement + api.session.subscriptionId + "/services/hostedservices"
564 expectedPayload, err := marshalXML(createHostedService)564 expectedPayload, err := marshalXML(createHostedService)
565 c.Assert(err, IsNil)565 c.Assert(err, IsNil)
566 checkOneRequest(c, recordedRequests, expectedURL, "2012-03-01", expectedPayload, "POST")566 checkOneRequest(c, recordedRequests, expectedURL, "2013-10-01", expectedPayload, "POST")
567}567}
568568
569func makeAvailabilityResponse(result, reason string) string {569func makeAvailabilityResponse(result, reason string) string {
@@ -591,8 +591,8 @@
591591
592 c.Assert(err, IsNil)592 c.Assert(err, IsNil)
593 expectedURL := (defaultManagement + api.session.subscriptionId +593 expectedURL := (defaultManagement + api.session.subscriptionId +
594 "/services/hostedservices/operations/isavailable/" + serviceName)594 "/services/hostedservices/operations/isavailable/" + serviceName)
595 checkOneRequest(c, &recordedRequests, expectedURL, "2012-03-01", nil, "GET")595 checkOneRequest(c, &recordedRequests, expectedURL, "2013-10-01", nil, "GET")
596}596}
597597
598func (*managementBaseAPISuite) TestAddHostedServiceWithBadName(c *C) {598func (*managementBaseAPISuite) TestAddHostedServiceWithBadName(c *C) {
@@ -613,8 +613,8 @@
613 c.Assert(err, ErrorMatches, reason)613 c.Assert(err, ErrorMatches, reason)
614 c.Check(recordedRequests, HasLen, 1)614 c.Check(recordedRequests, HasLen, 1)
615 expectedURL := (defaultManagement + api.session.subscriptionId +615 expectedURL := (defaultManagement + api.session.subscriptionId +
616 "/services/hostedservices/operations/isavailable/" + serviceName)616 "/services/hostedservices/operations/isavailable/" + serviceName)
617 checkOneRequest(c, &recordedRequests, expectedURL, "2012-03-01", nil, "GET")617 checkOneRequest(c, &recordedRequests, expectedURL, "2013-10-01", nil, "GET")
618}618}
619619
620func (*managementBaseAPISuite) TestAddHostedServiceWithServerError(c *C) {620func (*managementBaseAPISuite) TestAddHostedServiceWithServerError(c *C) {
@@ -689,14 +689,14 @@
689 expectedURL := defaultManagement + api.session.subscriptionId + "/services/hostedservices/" + serviceName + "/deployments"689 expectedURL := defaultManagement + api.session.subscriptionId + "/services/hostedservices/" + serviceName + "/deployments"
690 expectedPayload, err := marshalXML(deployment)690 expectedPayload, err := marshalXML(deployment)
691 c.Assert(err, IsNil)691 c.Assert(err, IsNil)
692 checkOneRequest(c, recordedRequests, expectedURL, "2012-03-01", expectedPayload, "POST")692 checkOneRequest(c, recordedRequests, expectedURL, "2013-10-01", expectedPayload, "POST")
693}693}
694694
695func assertDeleteDeploymentRequest(c *C, api *ManagementAPI, hostedServiceName, deploymentName string, httpRequest *X509Request) {695func assertDeleteDeploymentRequest(c *C, api *ManagementAPI, hostedServiceName, deploymentName string, httpRequest *X509Request) {
696 expectedURL := fmt.Sprintf(696 expectedURL := fmt.Sprintf(
697 "%s%s/services/hostedservices/%s/deployments/%s", defaultManagement,697 "%s%s/services/hostedservices/%s/deployments/%s", defaultManagement,
698 api.session.subscriptionId, hostedServiceName, deploymentName)698 api.session.subscriptionId, hostedServiceName, deploymentName)
699 checkRequest(c, httpRequest, expectedURL, "2012-03-01", nil, "DELETE")699 checkRequest(c, httpRequest, expectedURL, "2013-10-01", nil, "DELETE")
700}700}
701701
702func (suite *managementBaseAPISuite) TestDeleteDeployment(c *C) {702func (suite *managementBaseAPISuite) TestDeleteDeployment(c *C) {
@@ -795,7 +795,7 @@
795 expectedURL := fmt.Sprintf(795 expectedURL := fmt.Sprintf(
796 "%s%s/services/hostedservices/%s/deployments/%s", defaultManagement,796 "%s%s/services/hostedservices/%s/deployments/%s", defaultManagement,
797 api.session.subscriptionId, request.ServiceName, request.DeploymentName)797 api.session.subscriptionId, request.ServiceName, request.DeploymentName)
798 checkRequest(c, httpRequest, expectedURL, "2012-03-01", nil, "GET")798 checkRequest(c, httpRequest, expectedURL, "2013-10-01", nil, "GET")
799}799}
800800
801func (suite *managementBaseAPISuite) TestGetDeployment(c *C) {801func (suite *managementBaseAPISuite) TestGetDeployment(c *C) {
@@ -838,7 +838,7 @@
838 expectedURL := defaultManagement + api.session.subscriptionId + "/services/storageservices"838 expectedURL := defaultManagement + api.session.subscriptionId + "/services/storageservices"
839 expectedPayload, err := marshalXML(cssi)839 expectedPayload, err := marshalXML(cssi)
840 c.Assert(err, IsNil)840 c.Assert(err, IsNil)
841 checkOneRequest(c, &recordedRequests, expectedURL, "2012-03-01", expectedPayload, "POST")841 checkOneRequest(c, &recordedRequests, expectedURL, "2013-10-01", expectedPayload, "POST")
842}842}
843843
844func (suite *managementBaseAPISuite) TestDeleteStorageAccount(c *C) {844func (suite *managementBaseAPISuite) TestDeleteStorageAccount(c *C) {
@@ -967,11 +967,11 @@
967 err := api.StartRole(request)967 err := api.StartRole(request)
968 c.Assert(err, IsNil)968 c.Assert(err, IsNil)
969 expectedURL := (defaultManagement + api.session.subscriptionId + "/services/hostedservices/" +969 expectedURL := (defaultManagement + api.session.subscriptionId + "/services/hostedservices/" +
970 request.ServiceName + "/deployments/" + request.DeploymentName + "/roleinstances/" +970 request.ServiceName + "/deployments/" + request.DeploymentName + "/roleinstances/" +
971 request.RoleName + "/Operations")971 request.RoleName + "/Operations")
972 expectedPayload, err := marshalXML(startRoleOperation)972 expectedPayload, err := marshalXML(startRoleOperation)
973 c.Assert(err, IsNil)973 c.Assert(err, IsNil)
974 checkOneRequest(c, recordedRequests, expectedURL, "2012-03-01", expectedPayload, "POST")974 checkOneRequest(c, recordedRequests, expectedURL, "2013-10-01", expectedPayload, "POST")
975}975}
976976
977func (suite *managementBaseAPISuite) TestRestartRole(c *C) {977func (suite *managementBaseAPISuite) TestRestartRole(c *C) {
@@ -981,11 +981,11 @@
981 err := api.RestartRole(request)981 err := api.RestartRole(request)
982 c.Assert(err, IsNil)982 c.Assert(err, IsNil)
983 expectedURL := (defaultManagement + api.session.subscriptionId + "/services/hostedservices/" +983 expectedURL := (defaultManagement + api.session.subscriptionId + "/services/hostedservices/" +
984 request.ServiceName + "/deployments/" + request.DeploymentName + "/roleinstances/" +984 request.ServiceName + "/deployments/" + request.DeploymentName + "/roleinstances/" +
985 request.RoleName + "/Operations")985 request.RoleName + "/Operations")
986 expectedPayload, err := marshalXML(restartRoleOperation)986 expectedPayload, err := marshalXML(restartRoleOperation)
987 c.Assert(err, IsNil)987 c.Assert(err, IsNil)
988 checkOneRequest(c, recordedRequests, expectedURL, "2012-03-01", expectedPayload, "POST")988 checkOneRequest(c, recordedRequests, expectedURL, "2013-10-01", expectedPayload, "POST")
989}989}
990990
991func assertShutdownRoleRequest(c *C, api *ManagementAPI, request *ShutdownRoleRequest, httpRequest *X509Request) {991func assertShutdownRoleRequest(c *C, api *ManagementAPI, request *ShutdownRoleRequest, httpRequest *X509Request) {
@@ -995,7 +995,7 @@
995 request.DeploymentName, request.RoleName)995 request.DeploymentName, request.RoleName)
996 expectedPayload, err := marshalXML(shutdownRoleOperation)996 expectedPayload, err := marshalXML(shutdownRoleOperation)
997 c.Assert(err, IsNil)997 c.Assert(err, IsNil)
998 checkRequest(c, httpRequest, expectedURL, "2012-03-01", expectedPayload, "POST")998 checkRequest(c, httpRequest, expectedURL, "2013-10-01", expectedPayload, "POST")
999}999}
10001000
1001func (suite *managementBaseAPISuite) TestShutdownRole(c *C) {1001func (suite *managementBaseAPISuite) TestShutdownRole(c *C) {
@@ -1010,9 +1010,9 @@
10101010
1011func assertGetRoleRequest(c *C, api *ManagementAPI, httpRequest *X509Request, serviceName, deploymentName, roleName string) {1011func assertGetRoleRequest(c *C, api *ManagementAPI, httpRequest *X509Request, serviceName, deploymentName, roleName string) {
1012 expectedURL := (defaultManagement + api.session.subscriptionId +1012 expectedURL := (defaultManagement + api.session.subscriptionId +
1013 "/services/hostedservices/" +1013 "/services/hostedservices/" +
1014 serviceName + "/deployments/" + deploymentName + "/roles/" + roleName)1014 serviceName + "/deployments/" + deploymentName + "/roles/" + roleName)
1015 checkRequest(c, httpRequest, expectedURL, "2012-03-01", nil, "GET")1015 checkRequest(c, httpRequest, expectedURL, "2013-10-01", nil, "GET")
1016}1016}
10171017
1018func (suite *managementBaseAPISuite) TestGetRole(c *C) {1018func (suite *managementBaseAPISuite) TestGetRole(c *C) {
@@ -1038,10 +1038,10 @@
10381038
1039func assertUpdateRoleRequest(c *C, api *ManagementAPI, httpRequest *X509Request, serviceName, deploymentName, roleName, expectedXML string) {1039func assertUpdateRoleRequest(c *C, api *ManagementAPI, httpRequest *X509Request, serviceName, deploymentName, roleName, expectedXML string) {
1040 expectedURL := (defaultManagement + api.session.subscriptionId +1040 expectedURL := (defaultManagement + api.session.subscriptionId +
1041 "/services/hostedservices/" +1041 "/services/hostedservices/" +
1042 serviceName + "/deployments/" + deploymentName + "/roles/" + roleName)1042 serviceName + "/deployments/" + deploymentName + "/roles/" + roleName)
1043 checkRequest(1043 checkRequest(
1044 c, httpRequest, expectedURL, "2012-03-01", []byte(expectedXML), "PUT")1044 c, httpRequest, expectedURL, "2013-10-01", []byte(expectedXML), "PUT")
1045 c.Assert(httpRequest.ContentType, Equals, "application/xml")1045 c.Assert(httpRequest.ContentType, Equals, "application/xml")
1046}1046}
10471047
@@ -1126,7 +1126,7 @@
11261126
1127 expectedURL := defaultManagement + api.session.subscriptionId + "/affinitygroups"1127 expectedURL := defaultManagement + api.session.subscriptionId + "/affinitygroups"
1128 expectedBody, _ := cag.Serialize()1128 expectedBody, _ := cag.Serialize()
1129 checkOneRequest(c, &recordedRequests, expectedURL, "2012-03-01", []byte(expectedBody), "POST")1129 checkOneRequest(c, &recordedRequests, expectedURL, "2013-10-01", []byte(expectedBody), "POST")
1130}1130}
11311131
1132func (suite *managementBaseAPISuite) TestUpdateAffinityGroup(c *C) {1132func (suite *managementBaseAPISuite) TestUpdateAffinityGroup(c *C) {
@@ -1145,7 +1145,7 @@
1145 c.Assert(err, IsNil)1145 c.Assert(err, IsNil)
11461146
1147 expectedURL := (defaultManagement + api.session.subscriptionId +1147 expectedURL := (defaultManagement + api.session.subscriptionId +
1148 "/affinitygroups/" + request.Name)1148 "/affinitygroups/" + request.Name)
1149 expectedBody, _ := uag.Serialize()1149 expectedBody, _ := uag.Serialize()
1150 checkOneRequest(c, &recordedRequests, expectedURL, "2011-02-25", []byte(expectedBody), "PUT")1150 checkOneRequest(c, &recordedRequests, expectedURL, "2011-02-25", []byte(expectedBody), "PUT")
1151}1151}
@@ -1164,7 +1164,7 @@
1164 c.Assert(err, IsNil)1164 c.Assert(err, IsNil)
11651165
1166 expectedURL := (defaultManagement + api.session.subscriptionId +1166 expectedURL := (defaultManagement + api.session.subscriptionId +
1167 "/affinitygroups/" + request.Name)1167 "/affinitygroups/" + request.Name)
1168 checkOneRequest(c, &recordedRequests, expectedURL, "2011-02-25", nil, "DELETE")1168 checkOneRequest(c, &recordedRequests, expectedURL, "2011-02-25", nil, "DELETE")
1169}1169}
11701170
@@ -1232,7 +1232,7 @@
1232 expectedURL := fmt.Sprintf(1232 expectedURL := fmt.Sprintf(
1233 "%s%s/services/networking/media", defaultManagement,1233 "%s%s/services/networking/media", defaultManagement,
1234 api.session.subscriptionId)1234 api.session.subscriptionId)
1235 checkRequest(c, httpRequest, expectedURL, "2012-03-01", nil, "GET")1235 checkRequest(c, httpRequest, expectedURL, "2013-10-01", nil, "GET")
1236}1236}
12371237
1238func (suite *managementBaseAPISuite) TestGetNetworkConfiguration(c *C) {1238func (suite *managementBaseAPISuite) TestGetNetworkConfiguration(c *C) {
@@ -1271,7 +1271,7 @@
1271 expectedURL := fmt.Sprintf(1271 expectedURL := fmt.Sprintf(
1272 "%s%s/services/networking/media", defaultManagement,1272 "%s%s/services/networking/media", defaultManagement,
1273 api.session.subscriptionId)1273 api.session.subscriptionId)
1274 checkRequest(c, httpRequest, expectedURL, "2012-03-01", body, "PUT")1274 checkRequest(c, httpRequest, expectedURL, "2013-10-01", body, "PUT")
1275 // Azure chokes when the content type is text/xml or similar.1275 // Azure chokes when the content type is text/xml or similar.
1276 c.Assert(httpRequest.ContentType, Equals, "application/octet-stream")1276 c.Assert(httpRequest.ContentType, Equals, "application/octet-stream")
1277}1277}
12781278
=== modified file 'xmlobjects.go'
--- xmlobjects.go 2013-07-25 22:02:41 +0000
+++ xmlobjects.go 2013-10-31 04:14:10 +0000
@@ -89,7 +89,7 @@
89 Hostname: Hostname,89 Hostname: Hostname,
90 Username: Username,90 Username: Username,
91 Password: Password,91 Password: Password,
92 CustomData: CustomData,92 CustomData: base64.StdEncoding.EncodeToString([]byte(CustomData)),
93 DisableSSHPasswordAuthentication: DisableSSHPasswordAuthentication,93 DisableSSHPasswordAuthentication: DisableSSHPasswordAuthentication,
94 }94 }
95}95}
9696
=== modified file 'xmlobjects_test.go'
--- xmlobjects_test.go 2013-07-25 22:02:41 +0000
+++ xmlobjects_test.go 2013-10-31 04:14:10 +0000
@@ -1322,7 +1322,7 @@
1322 c.Check(config.Hostname, Equals, hostname)1322 c.Check(config.Hostname, Equals, hostname)
1323 c.Check(config.Username, Equals, username)1323 c.Check(config.Username, Equals, username)
1324 c.Check(config.Password, Equals, password)1324 c.Check(config.Password, Equals, password)
1325 c.Check(config.CustomData, Equals, customdata)1325 c.Check(config.CustomData, Equals, base64.StdEncoding.EncodeToString([]byte(customdata)))
1326 c.Check(config.DisableSSHPasswordAuthentication, Equals, disablessh)1326 c.Check(config.DisableSSHPasswordAuthentication, Equals, disablessh)
1327 c.Check(config.ConfigurationSetType, Equals, "LinuxProvisioningConfiguration")1327 c.Check(config.ConfigurationSetType, Equals, "LinuxProvisioningConfiguration")
1328}1328}

Subscribers

People subscribed via source and target branches

to all changes: