error checks for vsphere create and delete folder (#6095)

This commit is contained in:
Ricard Clau 2016-04-08 22:22:36 +01:00 committed by Paul Stack
parent 544d05b818
commit 26bc88a1cc
1 changed files with 8 additions and 2 deletions

View File

@ -58,7 +58,10 @@ func resourceVSphereFolderCreate(d *schema.ResourceData, meta interface{}) error
f.datacenter = v.(string)
}
createFolder(client, &f)
err := createFolder(client, &f)
if err != nil {
return err
}
d.Set("existing_path", f.existingPath)
d.SetId(fmt.Sprintf("%v/%v", f.datacenter, f.path))
@ -153,7 +156,10 @@ func resourceVSphereFolderDelete(d *schema.ResourceData, meta interface{}) error
client := meta.(*govmomi.Client)
deleteFolder(client, &f)
err := deleteFolder(client, &f)
if err != nil {
return err
}
d.SetId("")
return nil