Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vsphere_guest - Display relevant error message when user tries to perform state operation on a vm which doesn't exists #19716

Merged
merged 1 commit into from
Jun 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/ansible/modules/cloud/vmware/vsphere_guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1879,6 +1879,12 @@ def main():
elif state == 'absent':
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
elif state in ['present', 'powered_off', 'powered_on'] and not all((vm_extra_config,
vm_hardware, vm_disk, vm_nic, esxi)):
module.exit_json(changed=False, msg="vm %s not present" % guest)


# Create the VM
elif state in ['present', 'powered_off', 'powered_on']:

Expand Down