We have a large number of templates per provider (~800) and we’re populating a dynamic dialog with operating_system.product_name, and then refreshing the 2nd list of dynamic dialogs with only templates that match that OS.
The current method we’re using is this:
$evm.vmdb(:ManageIQ_Providers_Vmware_InfraManager_Template).all.each`
I want to improve the performance of this service catalog view and use the values from the API directly for OS type (knowing it may return an empty list in the 2nd dialog) https://code.vmware.com/apis/42/vsphere#https://vdc-repo.vmware.com/vmwb-repository/dcr-public/98d63b35-d822-47fe-a87a-ddefd469df06/8212891f-77f8-4d27-ab3b-9e2fa52e5355/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html
In my reading it looks like using
.find(:all, :conditions => [])
is no longer recommended.
What is the preferred method to grab a subset of templates without iterating over the entire list?
Gist: https://gist.github.com/rvalente/1765b166717d96b25d78bf8c47b3688f
Thanks,
Ron