use the Datacenter's VmFolder instead of hand generating it

This commit is contained in:
Joshua Foster 2020-06-01 19:53:54 -04:00
parent 374f82b978
commit 30bff17799
1 changed files with 6 additions and 1 deletions

View File

@ -21,7 +21,12 @@ func (d *Driver) NewFolder(ref *types.ManagedObjectReference) *Folder {
}
func (d *Driver) FindFolder(name string) (*Folder, error) {
f, err := d.finder.Folder(d.ctx, fmt.Sprintf("/%v/vm/%v", d.datacenter.Name(), name))
folders, err := d.datacenter.Folders(d.ctx)
if err != nil {
return nil, err
}
f, err := d.finder.Folder(d.ctx, fmt.Sprintf("%v/%v", folders.VmFolder.InventoryPath, name))
if err != nil {
return nil, err
}