Skip to content

Commit

Permalink
Fixed DeleteVMDeployment method
Browse files Browse the repository at this point in the history
Fixed DeleteVMDeployment method
  • Loading branch information
ruslangabitov committed Nov 25, 2014
1 parent 7a49539 commit 3689d99
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions clients/vmClient/vmClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/MSOpenTech/azure-sdk-for-go/clients/imageClient"
"github.com/MSOpenTech/azure-sdk-for-go/clients/locationClient"
"github.com/MSOpenTech/azure-sdk-for-go/clients/storageServiceClient"
"github.com/MSOpenTech/azure-sdk-for-go/clients/vmDiskClient"
)

const (
Expand All @@ -28,6 +27,7 @@ const (
azureHostedServiceURL = "services/hostedservices/%s"
azureHostedServiceAvailabilityURL = "services/hostedservices/operations/isavailable/%s"
azureDeploymentURL = "services/hostedservices/%s/deployments/%s"
deleteAzureDeploymentURL = "services/hostedservices/%s/deployments/%s?comp=media"
azureRoleURL = "services/hostedservices/%s/deployments/%s/roles/%s"
azureOperationsURL = "services/hostedservices/%s/deployments/%s/roleinstances/%s/Operations"
azureCertificatListURL = "services/hostedservices/%s/certificates"
Expand Down Expand Up @@ -358,25 +358,14 @@ func DeleteVMDeployment(cloudserviceName, deploymentName string) error {
return fmt.Errorf(azure.ParamNotSpecifiedError, "deploymentName")
}

vmDeployment, err := GetVMDeployment(cloudserviceName, deploymentName)
if err != nil {
return err
}
vmDiskName := vmDeployment.RoleList.Role[0].OSVirtualHardDisk.DiskName

requestURL := fmt.Sprintf(azureDeploymentURL, cloudserviceName, deploymentName)
requestURL := fmt.Sprintf(deleteAzureDeploymentURL, cloudserviceName, deploymentName)
requestId, err := azure.SendAzureDeleteRequest(requestURL)
if err != nil {
return err
}

azure.WaitAsyncOperation(requestId)

err = vmDiskClient.DeleteDisk(vmDiskName)
if err != nil {
return err
}

return nil
}

Expand Down

0 comments on commit 3689d99

Please sign in to comment.