vmware_vm_facts: fix the support with regular ESXi

Ensure the module still work with the ESXi where CustomFieldsManager
does not exist.

From: https://www.vmware.com/support/developer/converter-sdk/conv60_apireference/vim.CustomFieldsManager.html

    The CustomFieldsManager object is used to add and remove custom fields to
    managed entities.
    The custom fields values set on managed entities are available through the
    customValue property and through the summary objects for VirtualMachine
    and HostSystem. They are not available directly through this managed object.
    This functionality is only available through VirtualCenter.

Fixes: #56071
This commit is contained in:
Gonéri Le Bouder 2019-05-03 18:08:42 -04:00
parent 21d4e239b4
commit cf78759f5b
7 changed files with 33 additions and 18 deletions

View file

@ -139,7 +139,6 @@ from ansible.module_utils.vmware import PyVmomi, vmware_argument_spec
class VmAttributeManager(PyVmomi):
def __init__(self, module):
super(VmAttributeManager, self).__init__(module)
self.custom_field_mgr = self.content.customFieldsManager.field
def set_custom_field(self, vm, user_fields):
result_fields = dict()