**Problem: While hitting compute resource detail api it’s not returning the datacenter name but only returning the datacenter id only in response for oVirt & VMware provider. Could anyone please suggest how to fix this problem?
datacenter listed refers to the uuid of it. There seems to be a private method loading the datacenter object in vmware model. You could probably add a new public method datacenter_name that uses this dc method and returns the name. Then add it to the attributes list in the view definition.
@Marek_Hulan I got your point but I don’t have much knowledge of ruby language. If you can share code & I will update the source code files of my foreman server.
Thanks in advance.
I don’t have vmware instance at hand. Something like
def datacenter_name
dc.name
end
could work. I’m not sure how fog-vsphere calls it, just guessing it’s a name. Then just add this to the list of attributes in the rabl template.
You can experiment with your method if you start foreman-rake console. You can do something like Foreman::Model::Vmware.first.datacenter_name. Or you can see list of all methods on the dc object like this Foreman::Model::Vmware.first.send(:dc).methods. Send bypasses the private restriction.