[Resolved]Get templates from selected vCenters


#1

Say i have vcenterA, vcenterB & vcenterC . If a user selects vcenterA i want to just get templates from vcenterA and not get templates from vcenterB or C. I cant get the vcenter by doing “.where(:name => ‘vcenterA’)” but getting error when trying to just get templates


#2
provider_id =  $evm.vmdb(:ext_management_system).where(name: 'NAME').first.id
templates = $evm.vmdb(:vm_or_template).where(ext_management_system: provider_id, template: true)

Is that what you are looking for?


#3

Awsome , thats exactly what i was looking for. I was banging my head around for hours

Thanks again


#4

:fu: