Don't error if unable to undeploy

This commit is contained in:
Brett Mack 2015-11-25 16:53:00 +00:00
parent a02667389e
commit aec94b1682
1 changed files with 6 additions and 12 deletions

View File

@ -315,24 +315,18 @@ func resourceVcdVAppDelete(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("error finding vapp: %s", err)
}
status, err := vapp.GetStatus()
if err != nil {
return fmt.Errorf("Error getting VApp status: %#v", err)
}
if status == "POWERED_ON" {
err = retryCall(vcdClient.MaxRetryTimeout, func() error {
task, err := vapp.Undeploy()
if err != nil {
return fmt.Errorf("Error undeploying: %#v", err)
}
return task.WaitTaskCompletion()
})
_ = retryCall(vcdClient.MaxRetryTimeout, func() error {
task, err := vapp.Undeploy()
if err != nil {
return err
return fmt.Errorf("Error undeploying: %#v", err)
}
}
return task.WaitTaskCompletion()
})
err = retryCall(vcdClient.MaxRetryTimeout, func() error {
task, err := vapp.Delete()