From dd73bae51aafab32088a377acac30f355762b45b Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Fri, 27 Jul 2018 10:25:21 +0530 Subject: [PATCH] VMware: handle indexError for snapshot details (#42575) Fixes: #42539 Signed-off-by: Abhijeet Kasurde --- lib/ansible/module_utils/vmware.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/vmware.py b/lib/ansible/module_utils/vmware.py index 886994e535a..091f725d5dd 100644 --- a/lib/ansible/module_utils/vmware.py +++ b/lib/ansible/module_utils/vmware.py @@ -437,8 +437,10 @@ def list_snapshots(vm): result['snapshots'] = list_snapshots_recursively(vm.snapshot.rootSnapshotList) current_snapref = vm.snapshot.currentSnapshot current_snap_obj = get_current_snap_obj(vm.snapshot.rootSnapshotList, current_snapref) - result['current_snapshot'] = deserialize_snapshot_obj(current_snap_obj[0]) - + if current_snap_obj: + result['current_snapshot'] = deserialize_snapshot_obj(current_snap_obj[0]) + else: + result['current_snapshot'] = dict() return result