Before I patch my VM,
- delete the old snapshot (class DeleteSnapshot)
- rename the latest/current snapshot to old (class RenameSnapshot)
- take a new current snapshot (class TakeSnapshot)
Since I want it done by a Jenkins Pipeline automatically,
I can not predict if there any of the current or old vm snapshot exists.
DeleteSnapshot supports failOnNoExist parameter.
If is set to false, the build step doesn't fail, if the snapshot does not exists.
RenameSnapshot doesn't supports failOnNoExist.
If the snapshot to be renamed doesn't exists, the build step fails in any case.
- RenameSnapshot should be extended with boolean failOnNoExist parameter
- VSphere#renameVmSnapshot should be extended with boolean failOnNoExist parameter and treet a non existing snapshot like the VSphere#deleteSnapshot method
- default value/behaviour of failOnNoExist