The azlin update command updates all development tools installed on an azlin VM.
Purpose: Core logic for updating tools on VMs
Classes:
-
UpdateResult(dataclass)tool_name: str- Name of the tool updatedsuccess: bool- Whether update succeededmessage: str- Success/error messageduration: float- Time taken in seconds
-
VMUpdateSummary(dataclass)vm_name: str- VM identifiertotal_updates: int- Total tools attemptedsuccessful: List[UpdateResult]- Successful updatesfailed: List[UpdateResult]- Failed updatestotal_duration: float- Total time taken
Properties:
success_count- Count of successful updatesfailure_count- Count of failed updatesall_succeeded- True if all succeededany_failed- True if any failed
-
VMUpdaterMethods:
-
update_vm(ssh_config: SSHConfig) -> VMUpdateSummary- Main entry point to update all tools on a VM
- Returns summary of all update attempts
-
_update_system_packages() -> UpdateResult- Updates apt packages
- Command:
sudo apt update && sudo apt upgrade -y
-
_update_azure_cli() -> UpdateResult- Updates Azure CLI
- Command:
az upgrade --yes
-
_update_github_cli() -> UpdateResult- Updates GitHub CLI extensions
- Command:
gh extension upgrade --all
-
_update_npm() -> UpdateResult- Updates npm itself
- Command:
npm install -g npm@latest
-
_update_npm_packages() -> UpdateResult- Updates global npm packages (copilot, codex, claude-code)
- Command:
npm update -g
-
_update_rust() -> UpdateResult- Updates Rust toolchain
- Command:
rustup update
-
_update_golang() -> UpdateResult- Checks and updates Go
- Downloads latest if newer version available
-
_update_dotnet() -> UpdateResult- Checks and updates .NET
- Downloads latest RC if newer version available
-
_update_astral_uv() -> UpdateResult- Updates uv snap package
- Command:
snap refresh astral-uv
-
Command: azlin update <vm_identifier>
Parameters:
vm_identifier: str- VM name, session name, or IP--resource-group, -g: str- Resource group (optional)--config: str- Config file path (optional)--timeout: int- Timeout per update in seconds (default: 300)
Flow:
- Resolve VM identifier (session name → VM name, or direct VM name)
- Get VM info from Azure
- Build SSH config
- Create VMUpdater instance
- Execute update
- Display progress with ProgressDisplay
- Show summary at end
Updates run sequentially because:
- Some updates may trigger system restarts or reload PATH
- apt updates should complete before other package managers
- Easier to troubleshoot failures
- Lower risk of resource contention
Order:
- System packages (apt) - Foundation, affects other tools
- Azure CLI - Independent
- GitHub CLI - Independent
- npm - Required before npm packages
- npm packages - Depends on npm
- Rust - Independent
- Go - Independent
- .NET - Independent
- astral-uv - Independent
- Each update wrapped in try/except
- Failures don't stop subsequent updates
- All results collected and reported
- Exit codes:
- 0: All updates succeeded
- 1: Partial success (some failed)
- 2: Complete failure (all failed or connection error)
Use existing ProgressDisplay module:
- Show current tool being updated
- Display progress percentage
- Estimated time remaining
- Success/failure indicators (✓/✗)
- Test each
_update_*method in isolation - Mock SSH execution with various responses
- Test error handling for each tool
- Test UpdateResult and VMUpdateSummary dataclasses
- Test update sequencing
- Test full update flow with mock SSH
- Test session name resolution
- Test partial failure scenarios
- Test timeout handling
- Mock
RemoteExecutor.execute_command - Return realistic output for each tool
- Simulate various failure scenarios
A: Sequential. Safer, easier to debug, some updates depend on others.
A: Not in v1. Keep it simple - update everything.
A: Not in v1. Can add later if needed.
A: Use existing logging infrastructure. INFO level for success, ERROR for failures.
- All commands use
RemoteExecutor(already sanitized) - No shell=True
- No user input in commands
- Use existing SSH key authentication
- Timeouts enforced on all operations
✓ Ruthless Simplicity: Single-purpose module, clear responsibilities ✓ Bricks & Studs: Reuses existing modules (RemoteExecutor, ProgressDisplay, SSHConnector) ✓ Zero BS: No TODOs, no stubs, no placeholders - complete implementation ✓ Test-Driven: Write tests first, then implement