func (f *Finder) HostSystemList(ctx context.Context, path string) ([]*object.HostSystem, error) { es, err := f.find(ctx, f.hostFolder, false, path) if err != nil { return nil, err } var hss []*object.HostSystem for _, e := range es { var hs *object.HostSystem switch o := e.Object.(type) { case mo.HostSystem: hs = object.NewHostSystem(f.client, o.Reference()) case mo.ComputeResource: cr := object.NewComputeResource(f.client, o.Reference()) hosts, err := cr.Hosts(ctx) if err != nil { return nil, err } hs = object.NewHostSystem(f.client, hosts[0]) default: continue } hs.InventoryPath = e.Path hss = append(hss, hs) } if len(hss) == 0 { return nil, &NotFoundError{"host", path} } return hss, nil }