Add retry calls to protect against api rate limiting
This commit is contained in:
parent
c8dfecc65f
commit
29dfc4322e
|
@ -313,26 +313,29 @@ func resourceVcdVAppDelete(d *schema.ResourceData, meta interface{}) error {
|
|||
vapp, err := vcdClient.OrgVdc.FindVAppByName(d.Id())
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("error finding vdc: %s", err)
|
||||
return fmt.Errorf("error finding vapp: %s", err)
|
||||
}
|
||||
|
||||
err = retryCall(4, func() error {
|
||||
task, err := vapp.Undeploy()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error Powering Off: %#v", err)
|
||||
}
|
||||
err = task.WaitTaskCompletion()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error completing tasks: %#v", err)
|
||||
return fmt.Errorf("Error undeploying: %#v", err)
|
||||
}
|
||||
|
||||
task, err = vapp.Delete()
|
||||
return task.WaitTaskCompletion()
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error Powering Off: %#v", err)
|
||||
}
|
||||
err = task.WaitTaskCompletion()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error completing tasks: %#v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
err = retryCall(4, func() error {
|
||||
task, err := vapp.Delete()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error deleting: %#v", err)
|
||||
}
|
||||
|
||||
return task.WaitTaskCompletion()
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue