[azure-arm] retry cleanup individual resources on error
This commit is contained in:
parent
9cefd69f0d
commit
fcfa54fb1d
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/builder/azure/common/constants"
|
"github.com/hashicorp/packer/builder/azure/common/constants"
|
||||||
|
retry "github.com/hashicorp/packer/common"
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
"github.com/hashicorp/packer/packer"
|
"github.com/hashicorp/packer/packer"
|
||||||
)
|
)
|
||||||
|
@ -93,11 +94,19 @@ func (s *StepDeleteResourceGroup) deleteDeploymentResources(ctx context.Context,
|
||||||
resourceType,
|
resourceType,
|
||||||
resourceName))
|
resourceName))
|
||||||
|
|
||||||
|
err := retry.Retry(10, 600, 10, func(attempt uint) (bool, error) {
|
||||||
err := deleteResource(ctx, s.client,
|
err := deleteResource(ctx, s.client,
|
||||||
resourceType,
|
resourceType,
|
||||||
resourceName,
|
resourceName,
|
||||||
resourceGroupName)
|
resourceGroupName)
|
||||||
|
if err != nil {
|
||||||
s.reportIfError(err, resourceName)
|
s.reportIfError(err, resourceName)
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, nil
|
||||||
|
})
|
||||||
|
|
||||||
if err = deploymentOperations.Next(); err != nil {
|
if err = deploymentOperations.Next(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue