From 504a76863657aca7184f81ecafa07ecdf37e58c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Thu, 20 Apr 2017 12:11:04 +0200 Subject: [PATCH] Show UUID instead of name when using UUID to select snapshot (#23787) --- lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py b/lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py index 2834a43b023..451d8653aa1 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py @@ -298,7 +298,11 @@ def main(): uuid=module.params['uuid']) if not vm: - module.fail_json(msg="Unable to manage snapshots for non-existing VM %(name)s" % module.params) + # If UUID is set, getvm select UUID, show error message accordingly. + if module.params['uuid'] is not None: + module.fail_json(msg="Unable to manage snapshots for non-existing VM %(uuid)s" % module.params) + else: + module.fail_json(msg="Unable to manage snapshots for non-existing VM %(name)s" % module.params) if not module.params['snapshot_name'] and module.params['state'] != 'remove_all': module.fail_json(msg="snapshot_name param is required when state is '%(state)s'" % module.params)