Cloudforms - How to print vm templates

Hi all,

I was able to print all clusters thanks to $evm.vmdb(:ems_cluster) and filtering the results.
But I have no idea how to print the templates associated to clusters. I don’t find the method…I’m totally lost.

Could someone point me to the right direction?

Thank you very much,
Albert

You can do it like this:

Find the cluster’s object ID

$evm.vmdb(:ems_cluster).first.id
=> 1

Now search for all 'VMs or Templates" that have the boolean attribute “template” as “true”, and have an “ems_cluster_id” attribute that matches your cluster ID:

$evm.vmdb(:vm_or_template).where(["template = ? AND ems_cluster_id = ?",true,1]).length
=> 6

Hope this helps,
pemcg