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>
This commit is contained in:
Abhijeet Kasurde 2019-04-18 09:26:30 +05:30 committed by GitHub
parent f247c21d23
commit ffce456de9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

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

View file

@ -370,6 +370,8 @@ class VMwareDeployOvf:
if 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:
folder = datacenter.vmFolder