From 786aceb43b5a124740a5985ca79d1720e6b0d3c8 Mon Sep 17 00:00:00 2001 From: Mark Phillips Date: Wed, 24 Dec 2014 12:39:48 +0000 Subject: [PATCH] vsphere_guest fix for KeyError: folder message --- lib/ansible/modules/cloud/vmware/vsphere_guest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/vmware/vsphere_guest.py b/lib/ansible/modules/cloud/vmware/vsphere_guest.py index 378e3ecb9eb..805bfd5f3ce 100644 --- a/lib/ansible/modules/cloud/vmware/vsphere_guest.py +++ b/lib/ansible/modules/cloud/vmware/vsphere_guest.py @@ -684,7 +684,7 @@ def create_vm(vsphere_client, module, esxi, resource_pool, cluster_name, guest, hfmor = dcprops.hostFolder._obj # virtualmachineFolder managed object reference - if vm_extra_config['folder']: + if vm_extra_config.get('folder'): if vm_extra_config['folder'] not in vsphere_client._get_managed_objects(MORTypes.Folder).values(): vsphere_client.disconnect() module.fail_json(msg="Cannot find folder named: %s" % vm_extra_config['folder'])