vsphere_guest: corrected fix #19716 misbehaviour (#55285)

* vsphere_guest: corrected fix #19716 misbehaviour
* creating machines without vm_extra_config is possible
* power state operation on absent machines will fail

* changelog fragment for PR #55285 (vsphere_guest bugfix)
This commit is contained in:
Robert Osowiecki 2019-04-17 17:11:57 +02:00 committed by Toshio Kuratomi
parent 45ff67b744
commit 93758a5141
2 changed files with 6 additions and 3 deletions

View file

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

View file

@ -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']: