VMware compute resource cannot find VM folders when datacenters are themselves nested in folders
Using Foreman 1.20.1 and vCenter 6.7.
Our vCenter has folders at the top level, and the datacenter objects are in those folders.
We are successfully adding our vCenter as a compute resource in Foreman, however, when creating a new host - as well as when configuring compute profiles - the "Folder" drop-down box in the "Virtual Machine" tab is empty (and contains the text "No matches found"), despite there being folders in vCenter. If we move the datacenter objects out of the folders, directly under the top vCenter object, Foreman lists all the folders correctly.
This prevents creating hosts: when submitting the new host for provisioning with "No matches found" in the folder drop-down box, Foreman passes a nil folder path where fog-vsphere expects a string, causing a NoMethodError for String#sub.
I'm not sure whether this used to work or not. Folder listing has worked before for this Foreman-vCenter combination. However, we recently upgraded from Foreman 1.16 to 1.20 (through the intermediates), and vCenter 6.5 to 6.7, but it's unclear whether we actually had datacenters nested in folders prior to the upgrades.
Putting datacenters in folders is apparently a VMware recommendation when setting up vCenter. Maybe it has something to do with more flexible management of permissions?