1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

VMware: Handle No Permission exception while clone (#33806)

This fix adds exception handling for No Permission exception
raised while clone operation.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-12-14 19:13:23 +05:30 committed by GitHub
parent a09fd80bba
commit 4391f5c094
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1451,7 +1451,13 @@ class PyVmomiHelper(PyVmomi):
clonespec.config = self.configspec
clone_method = 'Clone'
task = vm_obj.Clone(folder=destfolder, name=self.params['name'], spec=clonespec)
try:
task = vm_obj.Clone(folder=destfolder, name=self.params['name'], spec=clonespec)
except vim.fault.NoPermission as e:
self.module.fail_json(msg="Failed to clone virtual machine %s to folder %s "
"due to permission issue: %s" % (self.params['name'],
destfolder,
to_native(e.msg)))
self.change_detected = True
else:
# ConfigSpec require name for VM creation