VMware {code} Community
tbarn
Contributor
Contributor

Getting the list of custom field keys from the CustomFieldsManager using pyVmomi?

Hi, I'm trying to use the pyvmomi python SDK to access the CustomFieldsManager's field value and iterate through the list to find the name vs key combinations.  I can do this with the Perl SDK by just treating the field as a list however when I try with pyvmomi I'm met with an error stating that 'property' object is not iterable.

Eg:

cfm = vim.CustomFieldsManager

for pairs in cfm.field:

    print(pairs)

TypeError:  'property' object is not iterable

My end goal though is just to be able to ask for and set a VM's values in custom fields by the custom field's name and with Perl I'd have to first find out the custom field's key based on its name string, perhaps I'm just doing this wrong now?  Just following the same methods I'd used in the Perl SDK that's all.

Any help would be appreciated.

Edit:  Oops sorry I posted this to the wrong subforum, could a mod move this to VMware vSphere™ Web Services SDK please?  Thanks!

Reply
0 Kudos
1 Reply
laurentsd
VMware Employee
VMware Employee

This is not a Web Client SDK question, moving this to the Web Services SDK (I can't find any Python forum)

Reply
0 Kudos