From c96bad461f9aad91a2b79e778f32f4ef917fb885 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Sat, 27 Jan 2018 02:53:47 +0530 Subject: [PATCH] VMware: Fix dvs idempotency issue (#35389) Signed-off-by: Abhijeet Kasurde --- lib/ansible/modules/cloud/vmware/vmware_guest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py index 97f98b86177..f33a2258f1a 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest.py @@ -947,7 +947,7 @@ class PyVmomiHelper(PyVmomi): # VDS switch pg_obj = find_obj(self.content, [vim.dvs.DistributedVirtualPortgroup], network_devices[key]['name']) - if (nic.device.backing and not hasattr(nic.device.backing, 'port')) or \ + if vm_obj is None or (nic.device.backing and not hasattr(nic.device.backing, 'port')) or \ (nic.device.backing and (nic.device.backing.port.portgroupKey != pg_obj.key or nic.device.backing.port.switchUuid != pg_obj.config.distributedVirtualSwitch.uuid)): dvs_port_connection = vim.dvs.PortConnection()