Attempting snapshot: 'NoneType object has no attribute 'rootSnapshotList'
gnunchucks opened this issue · 2 comments
I downloaded this module and added to my '.library' for snapshot and template testing. Even when following the exact format that you have laid out I'm still getting the following:
I was looking into the module source but nothing is jumping out to me hence the lack of a pull request so my initial thought was that it was my playbook but like I stated it is an exact copy of what I saw in your documentation. Am I doing something incorrect here?
ESXi 5.5
pyvmomi 5.5.0-2014.1.1
ansible 1.9
Looking at the module, I may just have never run into this error. I assume that the VM ansible1031 exists and has no existing snapshots. Try changing the _find_snapshot_by_name function to also catch an AttributeError. Sorry I'm guessing, I just don't currently have a setup where I could test this my self.
snap = None
try:
for root_snap in vm.snapshot.rootSnapshotList:
snap = find_snap(root_snap, name)
if snap is not None:
break
except (IndexError, AttributeError):
snap = None
return snap
You are correct that machine exists, has no prior snapshots and is powered on. I just added the AttributeError catch and it worked perfectly.
Thanks for taking the time to check that out.