Skip to content

Commit

Permalink
platform/api/azure: Don't wait for resource group deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
jepio committed Jul 3, 2024
1 parent 8262af9 commit 13553d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
7 changes: 1 addition & 6 deletions platform/api/azure/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"context"
"time"

azruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
)
Expand Down Expand Up @@ -58,11 +57,7 @@ func (a *API) TerminateResourceGroup(name string) error {
opts := &armresources.ResourceGroupsClientBeginDeleteOptions{
ForceDeletionTypes: to.Ptr("Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets"),
}
poller, err := a.rgClient.BeginDelete(context.TODO(), name, opts)
pollOpts := &azruntime.PollUntilDoneOptions{
Frequency: 15 * time.Second,
}
_, err = poller.PollUntilDone(context.TODO(), pollOpts)
_, err := a.rgClient.BeginDelete(context.TODO(), name, opts)
return err
}

Expand Down
5 changes: 1 addition & 4 deletions platform/api/azure/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,9 @@ func (a *API) TerminateInstance(machine *Machine, resourceGroup string) error {
_, err := a.compClient.BeginDelete(context.TODO(), resourceGroup, machine.ID, &armcompute.VirtualMachinesClientBeginDeleteOptions{
ForceDeletion: to.Ptr(true),
})
if err != nil {
return err
}
// We used to wait for the VM to be deleted here, but it's not necessary as
// we will also delete resource group later.
return nil
return err
}

func (a *API) GetConsoleOutput(name, resourceGroup, storageAccount string) ([]byte, error) {
Expand Down

0 comments on commit 13553d9

Please sign in to comment.