VMware: minor fix for vmware_deploy_ovf (#44299)

* Check value of ovf path
* Assign variable before using

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-08-20 09:39:05 +05:30 committed by GitHub
parent d73e9a6508
commit d06d1d4840
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -415,6 +415,9 @@ class VMwareDeployOvf:
return urlunparse(url_parts.as_list()) return urlunparse(url_parts.as_list())
def upload(self): def upload(self):
if self.params['ovf'] is None:
self.module.fail_json(msg="OVF path is required for upload operation.")
ovf_dir = os.path.dirname(self.params['ovf']) ovf_dir = os.path.dirname(self.params['ovf'])
lease, import_spec = self.get_lease() lease, import_spec = self.get_lease()
@ -436,6 +439,7 @@ class VMwareDeployOvf:
msg='Failed to find deviceUrl for file %s' % file_item.path msg='Failed to find deviceUrl for file %s' % file_item.path
) )
vmdk_tarinfo = None
if self.tar: if self.tar:
vmdk = self.tar vmdk = self.tar
try: try:
@ -458,7 +462,6 @@ class VMwareDeployOvf:
self.module.fail_json( self.module.fail_json(
msg='Failed to find VMDK file at %s' % vmdk msg='Failed to find VMDK file at %s' % vmdk
) )
vmdk_tarinfo = None
uploaders.append( uploaders.append(
VMDKUploader( VMDKUploader(