VMware: Handle NoneType in vmware_vmkernel_info (#65834)

Check for virtualNicManager in Esxi host system before accessing properties in vmware_vmkernel_info.

Fixes: #62772

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/66050/head
Abhijeet Kasurde 5 years ago committed by GitHub
parent 365820f871
commit 34acabd70a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- Check for virtualNicManager in Esxi host system before accessing properties in vmware_vmkernel_info (https://github.com/ansible/ansible/issues/62772).

@ -145,7 +145,7 @@ class VmkernelInfoManager(PyVmomi):
self.module.fail_json(msg="Failed to get all VMKs for service type %s due to" self.module.fail_json(msg="Failed to get all VMKs for service type %s due to"
"%s" % (service_type, to_native(e))) "%s" % (service_type, to_native(e)))
if not query.selectedVnic: if not query or not query.selectedVnic:
return vmks_list return vmks_list
selected_vnics = [vnic for vnic in query.selectedVnic] selected_vnics = [vnic for vnic in query.selectedVnic]
vnics_with_service_type = [vnic.device for vnic in query.candidateVnic if vnic.key in selected_vnics] vnics_with_service_type = [vnic.device for vnic in query.candidateVnic if vnic.key in selected_vnics]

Loading…
Cancel
Save