def ext_pillar(minion_id, pillar, **kwargs):
    '\n    Check vmware/vcenter for all data\n    '
    vmware_pillar = {}
    host = None
    username = None
    password = None
    property_types = []
    property_name = 'name'
    protocol = None
    port = None
    pillar_key = 'vmware'
    replace_default_attributes = False
    type_specific_pillar_attributes = {'VirtualMachine': [{'config': ['version', 'guestId', 'files', 'tools', 'flags', 'memoryHotAddEnabled', 'cpuHotAddEnabled', 'cpuHotRemoveEnabled', 'datastoreUrl', 'swapPlacement', 'bootOptions', 'scheduledHardwareUpgradeInfo', 'memoryAllocation', 'cpuAllocation']}, {'summary': [{'runtime': [{'host': ['name', {'parent': 'name'}]}, 'bootTime']}, {'guest': ['toolsStatus', 'toolsVersionStatus', 'toolsVersionStatus2', 'toolsRunningStatus']}, {'config': ['cpuReservation', 'memoryReservation']}, {'storage': ['committed', 'uncommitted', 'unshared']}, {'dasVmProtection': ['dasProtected']}]}, {'storage': [{'perDatastoreUsage': [{'datastore': 'name'}, 'committed', 'uncommitted', 'unshared']}]}], 'HostSystem': [{'datastore': ['name', 'overallStatus', {'summary': ['url', 'freeSpace', 'maxFileSize', 'maxVirtualDiskCapacity', 'maxPhysicalRDMFileSize', 'maxVirtualRDMFileSize', {'vmfs': ['capacity', 'blockSizeMb', 'maxBlocks', 'majorVersion', 'version', 'uuid', {'extent': ['diskName', 'partition']}, 'vmfsUpgradeable', 'ssd', 'local']}]}, {'vm': 'name'}]}, {'vm': ['name', 'overallStatus', {'summary': [{'runtime': 'powerState'}]}]}]}
    pillar_attributes = [{'summary': ['overallStatus']}, {'network': ['name', {'config': {'distributedVirtualSwitch': 'name'}}]}, {'datastore': ['name']}, {'parent': ['name']}]
    if ('pillar_key' in kwargs):
        pillar_key = kwargs['pillar_key']
    vmware_pillar[pillar_key] = {}
    if ('host' not in kwargs):
        log.error('VMWare external pillar configured but host is not specified in ext_pillar configuration.')
        return vmware_pillar
    else:
        host = kwargs['host']
        log.debug('vmware_pillar -- host = %s', host)
    if ('username' not in kwargs):
        log.error('VMWare external pillar requested but username is not specified in ext_pillar configuration.')
        return vmware_pillar
    else:
        username = kwargs['username']
        log.debug('vmware_pillar -- username = %s', username)
    if ('password' not in kwargs):
        log.error('VMWare external pillar requested but password is not specified in ext_pillar configuration.')
        return vmware_pillar
    else:
        password = kwargs['password']
        log.debug('vmware_pillar -- password = %s', password)
    if ('replace_default_attributes' in kwargs):
        replace_default_attributes = kwargs['replace_default_attributes']
        if replace_default_attributes:
            pillar_attributes = []
            type_specific_pillar_attributes = {}
    if ('property_types' in kwargs):
        for prop_type in kwargs['property_types']:
            if isinstance(prop_type, dict):
                property_types.append(getattr(vim, prop_type.keys()[0]))
                if isinstance(prop_type[prop_type.keys()[0]], list):
                    pillar_attributes = (pillar_attributes + prop_type[prop_type.keys()[0]])
                else:
                    log.warning('A property_type dict was specified, but its value is not a list')
            else:
                property_types.append(getattr(vim, prop_type))
    else:
        property_types = [vim.VirtualMachine]
    log.debug('vmware_pillar -- property_types = %s', property_types)
    if ('property_name' in kwargs):
        property_name = kwargs['property_name']
    else:
        property_name = 'name'
    log.debug('vmware_pillar -- property_name = %s', property_name)
    if ('protocol' in kwargs):
        protocol = kwargs['protocol']
        log.debug('vmware_pillar -- protocol = %s', protocol)
    if ('port' in kwargs):
        port = kwargs['port']
        log.debug('vmware_pillar -- port = %s', port)
    virtualgrain = None
    osgrain = None
    if ('virtual' in __grains__):
        virtualgrain = __grains__['virtual'].lower()
    if ('os' in __grains__):
        osgrain = __grains__['os'].lower()
    if ((virtualgrain == 'vmware') or (osgrain == 'vmware esxi') or (osgrain == 'esxi')):
        vmware_pillar[pillar_key] = {}
        try:
            _conn = salt.utils.vmware.get_service_instance(host, username, password, protocol, port, verify_ssl=kwargs.get('verify_ssl', True))
            if _conn:
                data = None
                for prop_type in property_types:
                    data = salt.utils.vmware.get_mor_by_property(_conn, prop_type, minion_id, property_name=property_name)
                    if data:
                        type_name = type(data).__name__.replace('vim.', '')
                        if hasattr(data, 'availableField'):
                            vmware_pillar[pillar_key]['annotations'] = {}
                            for availableField in data.availableField:
                                for customValue in data.customValue:
                                    if (availableField.key == customValue.key):
                                        vmware_pillar[pillar_key]['annotations'][availableField.name] = customValue.value
                        type_specific_pillar_attribute = []
                        if (type_name in type_specific_pillar_attributes):
                            type_specific_pillar_attribute = type_specific_pillar_attributes[type_name]
                        vmware_pillar[pillar_key] = dictupdate.update(vmware_pillar[pillar_key], _crawl_attribute(data, (pillar_attributes + type_specific_pillar_attribute)))
                        break
                Disconnect(_conn)
            else:
                log.error('Unable to obtain a connection with %s, please verify your vmware ext_pillar configuration', host)
        except RuntimeError:
            log.error('A runtime error occurred in the vmware_pillar, this is likely caused by an infinite recursion in a requested attribute.  Verify your requested attributes and reconfigure the pillar.')
        return vmware_pillar
    else:
        return {}
Check vmware/vcenter for all data
def ext_pillar(minion_id, pillar, **kwargs):
    '\n    \n    '
    vmware_pillar = {}
    host = None
    username = None
    password = None
    property_types = []
    property_name = 'name'
    protocol = None
    port = None
    pillar_key = 'vmware'
    replace_default_attributes = False
    type_specific_pillar_attributes = {'VirtualMachine': [{'config': ['version', 'guestId', 'files', 'tools', 'flags', 'memoryHotAddEnabled', 'cpuHotAddEnabled', 'cpuHotRemoveEnabled', 'datastoreUrl', 'swapPlacement', 'bootOptions', 'scheduledHardwareUpgradeInfo', 'memoryAllocation', 'cpuAllocation']}, {'summary': [{'runtime': [{'host': ['name', {'parent': 'name'}]}, 'bootTime']}, {'guest': ['toolsStatus', 'toolsVersionStatus', 'toolsVersionStatus2', 'toolsRunningStatus']}, {'config': ['cpuReservation', 'memoryReservation']}, {'storage': ['committed', 'uncommitted', 'unshared']}, {'dasVmProtection': ['dasProtected']}]}, {'storage': [{'perDatastoreUsage': [{'datastore': 'name'}, 'committed', 'uncommitted', 'unshared']}]}], 'HostSystem': [{'datastore': ['name', 'overallStatus', {'summary': ['url', 'freeSpace', 'maxFileSize', 'maxVirtualDiskCapacity', 'maxPhysicalRDMFileSize', 'maxVirtualRDMFileSize', {'vmfs': ['capacity', 'blockSizeMb', 'maxBlocks', 'majorVersion', 'version', 'uuid', {'extent': ['diskName', 'partition']}, 'vmfsUpgradeable', 'ssd', 'local']}]}, {'vm': 'name'}]}, {'vm': ['name', 'overallStatus', {'summary': [{'runtime': 'powerState'}]}]}]}
    pillar_attributes = [{'summary': ['overallStatus']}, {'network': ['name', {'config': {'distributedVirtualSwitch': 'name'}}]}, {'datastore': ['name']}, {'parent': ['name']}]
    if ('pillar_key' in kwargs):
        pillar_key = kwargs['pillar_key']
    vmware_pillar[pillar_key] = {}
    if ('host' not in kwargs):
        log.error('VMWare external pillar configured but host is not specified in ext_pillar configuration.')
        return vmware_pillar
    else:
        host = kwargs['host']
        log.debug('vmware_pillar -- host = %s', host)
    if ('username' not in kwargs):
        log.error('VMWare external pillar requested but username is not specified in ext_pillar configuration.')
        return vmware_pillar
    else:
        username = kwargs['username']
        log.debug('vmware_pillar -- username = %s', username)
    if ('password' not in kwargs):
        log.error('VMWare external pillar requested but password is not specified in ext_pillar configuration.')
        return vmware_pillar
    else:
        password = kwargs['password']
        log.debug('vmware_pillar -- password = %s', password)
    if ('replace_default_attributes' in kwargs):
        replace_default_attributes = kwargs['replace_default_attributes']
        if replace_default_attributes:
            pillar_attributes = []
            type_specific_pillar_attributes = {}
    if ('property_types' in kwargs):
        for prop_type in kwargs['property_types']:
            if isinstance(prop_type, dict):
                property_types.append(getattr(vim, prop_type.keys()[0]))
                if isinstance(prop_type[prop_type.keys()[0]], list):
                    pillar_attributes = (pillar_attributes + prop_type[prop_type.keys()[0]])
                else:
                    log.warning('A property_type dict was specified, but its value is not a list')
            else:
                property_types.append(getattr(vim, prop_type))
    else:
        property_types = [vim.VirtualMachine]
    log.debug('vmware_pillar -- property_types = %s', property_types)
    if ('property_name' in kwargs):
        property_name = kwargs['property_name']
    else:
        property_name = 'name'
    log.debug('vmware_pillar -- property_name = %s', property_name)
    if ('protocol' in kwargs):
        protocol = kwargs['protocol']
        log.debug('vmware_pillar -- protocol = %s', protocol)
    if ('port' in kwargs):
        port = kwargs['port']
        log.debug('vmware_pillar -- port = %s', port)
    virtualgrain = None
    osgrain = None
    if ('virtual' in __grains__):
        virtualgrain = __grains__['virtual'].lower()
    if ('os' in __grains__):
        osgrain = __grains__['os'].lower()
    if ((virtualgrain == 'vmware') or (osgrain == 'vmware esxi') or (osgrain == 'esxi')):
        vmware_pillar[pillar_key] = {}
        try:
            _conn = salt.utils.vmware.get_service_instance(host, username, password, protocol, port, verify_ssl=kwargs.get('verify_ssl', True))
            if _conn:
                data = None
                for prop_type in property_types:
                    data = salt.utils.vmware.get_mor_by_property(_conn, prop_type, minion_id, property_name=property_name)
                    if data:
                        type_name = type(data).__name__.replace('vim.', )
                        if hasattr(data, 'availableField'):
                            vmware_pillar[pillar_key]['annotations'] = {}
                            for availableField in data.availableField:
                                for customValue in data.customValue:
                                    if (availableField.key == customValue.key):
                                        vmware_pillar[pillar_key]['annotations'][availableField.name] = customValue.value
                        type_specific_pillar_attribute = []
                        if (type_name in type_specific_pillar_attributes):
                            type_specific_pillar_attribute = type_specific_pillar_attributes[type_name]
                        vmware_pillar[pillar_key] = dictupdate.update(vmware_pillar[pillar_key], _crawl_attribute(data, (pillar_attributes + type_specific_pillar_attribute)))
                        break
                Disconnect(_conn)
            else:
                log.error('Unable to obtain a connection with %s, please verify your vmware ext_pillar configuration', host)
        except RuntimeError:
            log.error('A runtime error occurred in the vmware_pillar, this is likely caused by an infinite recursion in a requested attribute.  Verify your requested attributes and reconfigure the pillar.')
        return vmware_pillar
    else:
        return {}