From e87d6d8a70ec94ff20133bd382a50bcdb54bc458 Mon Sep 17 00:00:00 2001 From: Ner'zhul Date: Mon, 9 Jan 2017 12:29:18 +0100 Subject: [PATCH] Unbreak vmware_guest module which was break by 818ef493ad80a5bf8411d409912e8f7f3affbfdb (#20036) --- lib/ansible/modules/cloud/vmware/vmware_guest.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py index dda8ab8854c..d2d54fc5f5f 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest.py @@ -1321,7 +1321,7 @@ class PyVmomiHelper(object): self.configure_cpu_and_memory(vm_obj=vm_obj, vm_creation=True) self.configure_disks(vm_obj=vm_obj) self.configure_network(vm_obj=vm_obj) - if self.should_deploy_from_template() and len(self.params['customize']) > 0: + if self.should_deploy_from_template() and len(self.params['customizations']) > 0: self.customize_vm(vm_obj=vm_obj) try: @@ -1334,7 +1334,7 @@ class PyVmomiHelper(object): clonespec = vim.vm.CloneSpec(template=self.params['is_template'], location=relospec) - if self.params['customize'] is True: + if len(self.params['customizations']) > 0: clonespec.customization = self.customspec clonespec.config = self.configspec @@ -1787,9 +1787,9 @@ def main(): module.params['folder'] = '/vm%(folder)s' % module.params module.params['folder'] = module.params['folder'].rstrip('/') - # Fail check, customize require template to be defined - if module.params["customize"] and not module.params['template']: - module.fail_json(msg="customize option is only valid when template option is defined") + # Fail check, customizations require template to be defined + if len(module.params['customizations']) > 0 and not module.params['template']: + module.fail_json(msg="customizations option is only valid when template option is defined") pyv = PyVmomiHelper(module) # Check if the VM exists before continuing