From dea2e3ef4e253a50f873eb781d51eab7fb3710e2 Mon Sep 17 00:00:00 2001 From: Kosta Mushkin Date: Wed, 25 Jun 2025 15:51:41 -0700 Subject: [PATCH] simplifying user flow --- .../05_vpg_operations/solution/create_vpg.py | 2 +- .../05_vpg_operations/working/create_vpg.py | 2 +- .../06_failover_test/solution/failover.py | 2 +- .../06_failover_test/working/failover.py | 2 +- prerequisites/requirements.txt | 3 +- zerto-labs-install.ps1 | 62 ++++++++++++++++++- 6 files changed, 66 insertions(+), 7 deletions(-) diff --git a/exercises/05_vpg_operations/solution/create_vpg.py b/exercises/05_vpg_operations/solution/create_vpg.py index 0629994..a27adb9 100644 --- a/exercises/05_vpg_operations/solution/create_vpg.py +++ b/exercises/05_vpg_operations/solution/create_vpg.py @@ -70,7 +70,7 @@ def main(): # Step 1: Create a ZVMLClient instance logging.info(f"Initializing ZVMLClient for ZVM at {ZVM_HOST}") parser = argparse.ArgumentParser(description='Create VPG and add specified VMs') - parser.add_argument('--vm-name', required=True, + parser.add_argument('--vm-name', default="CRM-3", help='VM name to add to the VPG') parser.add_argument('--vpg-name', default="Test-VPG-Python", help='Name of the VPG to create (default: Test-VPG-Python)') diff --git a/exercises/05_vpg_operations/working/create_vpg.py b/exercises/05_vpg_operations/working/create_vpg.py index d1e1bcb..0ca94b4 100644 --- a/exercises/05_vpg_operations/working/create_vpg.py +++ b/exercises/05_vpg_operations/working/create_vpg.py @@ -92,7 +92,7 @@ def main(): # TODO: Add code to parse arguments # HINT: Use this syntax: parser = argparse.ArgumentParser(description='Create VPG and add specified VMs') - parser.add_argument('--vm-name', required=True, + parser.add_argument('--vm-name', default="CRM-3", help='VM name to add to the VPG') parser.add_argument('--vpg-name', default="Test-VPG-Python", help='Name of the VPG to create (default: Test-VPG-Python)') diff --git a/exercises/06_failover_test/solution/failover.py b/exercises/06_failover_test/solution/failover.py index c04ba78..25e06f2 100644 --- a/exercises/06_failover_test/solution/failover.py +++ b/exercises/06_failover_test/solution/failover.py @@ -65,7 +65,7 @@ def main(): try: # Step 1: Parse command line arguments parser = argparse.ArgumentParser(description='Perform failover test on a VPG') - parser.add_argument('--vpg-name', required=True, + parser.add_argument('--vpg-name', default="CRM", help='Name of the VPG to test') args = parser.parse_args() diff --git a/exercises/06_failover_test/working/failover.py b/exercises/06_failover_test/working/failover.py index 265e8a4..b4e3b02 100644 --- a/exercises/06_failover_test/working/failover.py +++ b/exercises/06_failover_test/working/failover.py @@ -67,7 +67,7 @@ def main(): # TODO: Add code to get sites and site identifiers # HINT: Use this syntax: # parser = argparse.ArgumentParser(description='Perform failover test on a VPG') - # parser.add_argument('--vpg-name', required=True, + # parser.add_argument('--vpg-name', default="CRM", # help='Name of the VPG to test') # args = parser.parse_args() # ← ADD YOUR CODE HERE diff --git a/prerequisites/requirements.txt b/prerequisites/requirements.txt index d5bc8ca..6269d52 100644 --- a/prerequisites/requirements.txt +++ b/prerequisites/requirements.txt @@ -1,4 +1,5 @@ requests>=2.31.0 python-keycloak>=2.8.0 urllib3>=2.0.0 -python-dotenv>=1.0.0 \ No newline at end of file +python-dotenv>=1.0.0 +-e ./zvml-python-sdk \ No newline at end of file diff --git a/zerto-labs-install.ps1 b/zerto-labs-install.ps1 index 7448ad2..164ee04 100644 --- a/zerto-labs-install.ps1 +++ b/zerto-labs-install.ps1 @@ -4,6 +4,64 @@ param([string]$InstallPath = "C:\zerto-labs") Write-Host "=== Zerto Labs Installation Script ===" -ForegroundColor Cyan Write-Host "Installation path: $InstallPath" -ForegroundColor White +# Install Python 3.13.5 +Write-Host "`nInstalling Python 3.13.5..." -ForegroundColor Yellow + +# Create temp directory for Python installer +$TempDir = Join-Path $InstallPath "temp" +New-Item -ItemType Directory -Path $TempDir -Force | Out-Null + +# Download Python installer +$pythonUrl = "https://www.python.org/ftp/python/3.13.5/python-3.13.5-amd64.exe" +$pythonInstaller = Join-Path $TempDir "python-3.13.5-amd64.exe" + +Write-Host "Downloading Python 3.13.5..." -ForegroundColor Yellow +try { + $webClient = New-Object System.Net.WebClient + $webClient.DownloadFile($pythonUrl, $pythonInstaller) + $webClient.Dispose() + Write-Host "Python installer downloaded successfully!" -ForegroundColor Green +} +catch { + Write-Host "Failed to download Python installer: $($_.Exception.Message)" -ForegroundColor Red + exit 1 +} + +# Install Python with "add to path" option +Write-Host "Installing Python 3.13.5..." -ForegroundColor Yellow +Write-Host "This may take a few minutes. Please wait..." -ForegroundColor White + +try { + $process = Start-Process -FilePath $pythonInstaller -ArgumentList "/quiet", "InstallAllUsers=1", "PrependPath=1", "Include_test=0" -Wait -PassThru + if ($process.ExitCode -eq 0) { + Write-Host "Python installed successfully!" -ForegroundColor Green + } else { + Write-Host "Python installation failed with exit code: $($process.ExitCode)" -ForegroundColor Red + exit 1 + } +} +catch { + Write-Host "Failed to install Python: $($_.Exception.Message)" -ForegroundColor Red + exit 1 +} + +# Refresh environment variables +Write-Host "Refreshing environment variables..." -ForegroundColor Yellow +$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") + +# Verify Python installation +Write-Host "Verifying Python installation..." -ForegroundColor Yellow +$pythonVersion = python --version 2>$null +if ($pythonVersion) { + Write-Host "Python installation verified: $pythonVersion" -ForegroundColor Green +} else { + Write-Host "Python installation verification failed. Please restart your terminal and run the script again." -ForegroundColor Red + exit 1 +} + +# Clean up Python installer +Remove-Item -Path $pythonInstaller -Force + # Create installation directory if (!(Test-Path $InstallPath)) { Write-Host "Creating installation directory..." -ForegroundColor Yellow @@ -133,8 +191,8 @@ $readmeContent += "## Directory Structure`n" $readmeContent += "- `zvml-python-sdk/` - Zerto Virtual Manager Linux Python SDK`n" $readmeContent += "- `Zerto-Python-SDK-Hands-On-Labs/` - Hands-on labs and exercises`n`n" $readmeContent += "## Setup Instructions`n`n" -$readmeContent += "### 1. Install Python`n" -$readmeContent += "Make sure you have Python 3.8 or higher installed.`n`n" +$readmeContent += "### 1. Python Installation`n" +$readmeContent += "Python 3.13.5 has been automatically installed with 'Add to PATH' option.`n`n" $readmeContent += "### 2. Create Virtual Environment`n" $readmeContent += "```powershell`n" $readmeContent += "cd Zerto-Python-SDK-Hands-On-Labs`n"