Ensure any active leases are brokend before deleting

This commit is contained in:
Wilken Rivera 2020-08-11 16:39:24 -04:00
parent 920da9d0a4
commit aed97e1a8b
1 changed files with 5 additions and 1 deletions

View File

@ -35,8 +35,12 @@ func NewStepDeleteAdditionalDisks(client *AzureClient, ui packer.Ui) *StepDelete
func (s *StepDeleteAdditionalDisk) deleteBlob(storageContainerName string, blobName string) error {
blob := s.client.BlobStorageClient.GetContainerReference(storageContainerName).GetBlobReference(blobName)
err := blob.Delete(nil)
if _, err := blob.BreakLease(nil); err != nil {
s.say(s.client.LastError.Error())
return err
}
err := blob.Delete(nil)
if err != nil {
s.say(s.client.LastError.Error())
}