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())
|
vapp, err := vcdClient.OrgVdc.FindVAppByName(d.Id())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error finding vdc: %s", err)
|
return fmt.Errorf("error finding vapp: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
task, err := vapp.Undeploy()
|
err = retryCall(4, func() error {
|
||||||
|
task, err := vapp.Undeploy()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error undeploying: %#v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return task.WaitTaskCompletion()
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error Powering Off: %#v", err)
|
return err
|
||||||
}
|
|
||||||
err = task.WaitTaskCompletion()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error completing tasks: %#v", err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task, err = vapp.Delete()
|
err = retryCall(4, func() error {
|
||||||
if err != nil {
|
task, err := vapp.Delete()
|
||||||
return fmt.Errorf("Error Powering Off: %#v", err)
|
if err != nil {
|
||||||
}
|
return fmt.Errorf("Error deleting: %#v", err)
|
||||||
err = task.WaitTaskCompletion()
|
}
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Error completing tasks: %#v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return task.WaitTaskCompletion()
|
||||||
|
})
|
||||||
|
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue