VMware: handle indexError for snapshot details (#42575)

Fixes: #42539

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-07-27 10:25:21 +05:30 committed by ansibot
parent c62d9a023a
commit dd73bae51a

View file

@ -437,8 +437,10 @@ def list_snapshots(vm):
result['snapshots'] = list_snapshots_recursively(vm.snapshot.rootSnapshotList) result['snapshots'] = list_snapshots_recursively(vm.snapshot.rootSnapshotList)
current_snapref = vm.snapshot.currentSnapshot current_snapref = vm.snapshot.currentSnapshot
current_snap_obj = get_current_snap_obj(vm.snapshot.rootSnapshotList, current_snapref) current_snap_obj = get_current_snap_obj(vm.snapshot.rootSnapshotList, current_snapref)
if current_snap_obj:
result['current_snapshot'] = deserialize_snapshot_obj(current_snap_obj[0]) result['current_snapshot'] = deserialize_snapshot_obj(current_snap_obj[0])
else:
result['current_snapshot'] = dict()
return result return result