vsphere_guest: corrected fix #19716 misbehaviour (#55285)

* creating machines without vm_extra_config is possible
* power state operation on absent machines will fail

(cherry picked from commit 93758a5141)
pull/55714/head
Robert Osowiecki 6 years ago committed by Toshio Kuratomi
parent d9c065d217
commit 9aa9c11a1a

@ -0,0 +1,4 @@
---
bugfixes:
- vsphere_guest - creating machines without vm_extra_config allowed
- vsphere_guest - powering on/off absent virtual machine will fail

@ -1904,9 +1904,8 @@ def main():
module.exit_json(changed=False, msg="vm %s not present" % guest) module.exit_json(changed=False, msg="vm %s not present" % guest)
# check if user is trying to perform state operation on a vm which doesn't exists # check if user is trying to perform state operation on a vm which doesn't exists
elif state in ['present', 'powered_off', 'powered_on'] and not all((vm_extra_config, elif state in ['present', 'powered_off', 'powered_on'] and not all((vm_hardware, vm_disk, vm_nic, esxi)):
vm_hardware, vm_disk, vm_nic, esxi)): module.fail_json(msg="vm %s not present and not all options neccessary to create are provided" % guest)
module.exit_json(changed=False, msg="vm %s not present" % guest)
# Create the VM # Create the VM
elif state in ['present', 'powered_off', 'powered_on']: elif state in ['present', 'powered_off', 'powered_on']:

Loading…
Cancel
Save