If a VM is in the root of the datacenter its parent is the vmFolder. This folder was being skipped by the PropertyFilterSpec causing an undefined method error '[]' for nil:NilClass when accessing the vm['parent'] key.
Related issues
Bug #22798: VMware: Exception listing VMs in the root of the datacenter
Fixes #22798 - VMware: Fix exception listing VMs
If a VM is in the root of the datacenter its parent is the vmFolder.
This folder was being skipped by the PropertyFilterSpec causing an
undefined method error '[]' for nil:NilClass when accessing the
vm['parent'] key.