Fix unzip
This commit is contained in:
@@ -95,11 +95,12 @@ def _download_vm(vms_dir: str):
|
||||
logger.info("Download succeeds.")
|
||||
break # Download completed successfully
|
||||
|
||||
# Unzip the downloaded file
|
||||
logger.info("Unzipping the downloaded file...☕️")
|
||||
with zipfile.ZipFile(downloaded_file_path, 'r') as zip_ref:
|
||||
zip_ref.extractall(vms_dir)
|
||||
logger.info("Files have been successfully extracted to the directory: " + str(vms_dir))
|
||||
if downloaded_file_name.endswith(".zip"):
|
||||
# Unzip the downloaded file
|
||||
logger.info("Unzipping the downloaded file...☕️")
|
||||
with zipfile.ZipFile(downloaded_file_path, 'r') as zip_ref:
|
||||
zip_ref.extractall(vms_dir)
|
||||
logger.info("Files have been successfully extracted to the directory: " + str(vms_dir))
|
||||
|
||||
class DockerVMManager(VMManager):
|
||||
def __init__(self, registry_path=""):
|
||||
@@ -130,8 +131,12 @@ class DockerVMManager(VMManager):
|
||||
elif os_type == "Windows":
|
||||
URL = WINDOWS_X86_URL
|
||||
DOWNLOADED_FILE_NAME = URL.split('/')[-1]
|
||||
|
||||
if DOWNLOADED_FILE_NAME.endswith(".zip"):
|
||||
DOWNLOADED_FILE_NAME = DOWNLOADED_FILE_NAME[:-4]
|
||||
if not os.path.exists(os.path.join(VMS_DIR, DOWNLOADED_FILE_NAME)):
|
||||
vm_name = DOWNLOADED_FILE_NAME[:-4]
|
||||
else:
|
||||
vm_name = DOWNLOADED_FILE_NAME
|
||||
|
||||
if not os.path.exists(os.path.join(VMS_DIR, vm_name)):
|
||||
_download_vm(VMS_DIR)
|
||||
return os.path.join(VMS_DIR, DOWNLOADED_FILE_NAME)
|
||||
return os.path.join(VMS_DIR, vm_name)
|
||||
Reference in New Issue
Block a user