From bdb33b5756c085d096f8f58ca9880622fe3bbc44 Mon Sep 17 00:00:00 2001 From: Vyronas Tsingaras Date: Thu, 18 Jun 2015 14:23:43 +0300 Subject: [PATCH] Properly check if vm_hardware contains keys This commit fixes #1475 Signed-off-by: Vyronas Tsingaras --- lib/ansible/modules/cloud/vmware/vsphere_guest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/vmware/vsphere_guest.py b/lib/ansible/modules/cloud/vmware/vsphere_guest.py index a627187725f..6ac8b38d645 100644 --- a/lib/ansible/modules/cloud/vmware/vsphere_guest.py +++ b/lib/ansible/modules/cloud/vmware/vsphere_guest.py @@ -622,7 +622,7 @@ def reconfigure_vm(vsphere_client, vm, module, esxi, resource_pool, cluster_name cpuHotRemoveEnabled = bool(vm.properties.config.cpuHotRemoveEnabled) # Change Memory - if vm_hardware['memory_mb']: + if 'memory_mb' in vm_hardware: if int(vm_hardware['memory_mb']) != vm.properties.config.hardware.memoryMB: spec = spec_singleton(spec, request, vm) @@ -652,7 +652,7 @@ def reconfigure_vm(vsphere_client, vm, module, esxi, resource_pool, cluster_name changes['memory'] = vm_hardware['memory_mb'] # ====( Config Memory )====# - if vm_hardware['num_cpus']: + if 'num_cpus' in vm_hardware: if int(vm_hardware['num_cpus']) != vm.properties.config.hardware.numCPU: spec = spec_singleton(spec, request, vm)