VMware: Check return of FindByInventoryPath (#55282)

Check return value of FindByInventoryPath API which is used for
finding desired folder to deploy OVF.

Fixes: #54823

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/55546/head
Abhijeet Kasurde 6 years ago committed by GitHub
parent f247c21d23
commit ffce456de9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- Check return value of FindByInventoryPath API used for finding folder value (https://github.com/ansible/ansible/issues/54823).

@ -370,6 +370,8 @@ class VMwareDeployOvf:
if self.params['folder']: if self.params['folder']:
folder = self.si.searchIndex.FindByInventoryPath(self.params['folder']) folder = self.si.searchIndex.FindByInventoryPath(self.params['folder'])
if not folder:
self.module.fail_json(msg="Unable to find the specified folder %(folder)s" % self.params)
else: else:
folder = datacenter.vmFolder folder = datacenter.vmFolder

Loading…
Cancel
Save