vm-repair: allow preserving repair resources with --no-cleanup - #10304
Conversation
Add --no-cleanup to restore and automated repair flows, validate conflicting flags, document the behavior, and add regression coverage.
|
Hi Edwin Bernal Microsoft (@EdwinBernal1), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
The new user-facing “delete later” instructions omit --yes/--no-wait, which undermines the intended unattended-safe workflow and should be corrected before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a --no-cleanup switch to vm-repair restore and automated repair flows so callers can preserve the repair resource group (repair VM/disk copy) for later inspection, while keeping existing interactive behavior intact.
Changes:
- Add
--no-cleanup/--noarguments toaz vm repair restore,az vm repair repair-and-restore, andaz vm repair repair-button, and thread the flag through cleanup logic. - Add early validation to reject
--yesand--no-cleanuptogether onaz vm repair restore. - Document the new behavior and add regression/unit coverage around cleanup skipping and validator behavior.
File summaries
| File | Description |
|---|---|
| src/vm-repair/setup.py | Bumps extension version to 2.3.0. |
| src/vm-repair/HISTORY.rst | Documents the new --no-cleanup behavior and mutual exclusion with --yes. |
| src/vm-repair/azext_vm_repair/tests/latest/test_restore_no_cleanup.py | Adds unit/regression tests for skip-cleanup and validator mutual exclusion. |
| src/vm-repair/azext_vm_repair/repair_utils.py | Extends _clean_up_resources with skip_cleanup short-circuit and warning. |
| src/vm-repair/azext_vm_repair/custom.py | Plumbs no_cleanup through restore / automated flows and updates success messaging. |
| src/vm-repair/azext_vm_repair/_validators.py | Adds mutual exclusion validation for --yes + --no-cleanup on restore. |
| src/vm-repair/azext_vm_repair/_params.py | Registers the new CLI arguments for the affected commands. |
| src/vm-repair/azext_vm_repair/_help.py | Adds restore examples for --yes and --no-cleanup. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
vm-repair |
|
please resolve the code conflicts |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
[Release] Update index.json for extension [ vm-repair-2.3.2 ] : https://dev.azure.com/msazure/One/_build/results?buildId=180062922&view=results |
🤖 PR Validation —⚠️ Review suggested
Add --no-cleanup to restore and automated repair flows, validate conflicting flags, document the behavior, and add regression coverage.
Related command
az vm repair restoreaz vm repair repair-and-restoreaz vm repair repair-buttonSummary
Adds
--no-cleanupwith the--noalias so unattended VM repair workflows can preserve repair resources for inspection instead of deleting them.Description
Previously, unattended repair workflows had no way to decline resource cleanup:
--yescould block on an interactive confirmation.--yesdeleted the repair VM, copied disk, and repair resource group.This change introduces
--no-cleanupand its--noalias for:az vm repair restoreaz vm repair repair-and-restoreaz vm repair repair-buttonWhen enabled:
For
az vm repair restore,--yesand--no-cleanupare mutually exclusive because they request opposite cleanup behavior. Validation fails before network operations when both are provided.Existing behavior remains unchanged when
--no-cleanupis omitted.Testing
The complete non-live VM Repair test suite was executed on both Windows Python architectures:
The 35 skipped tests are live-only scenarios that require Azure resources. No live or billable Azure tests were executed.
Test coverage includes:
--no-cleanupis used.--yesand--no-cleanupare rejected when combined.--no-cleanup.--yesbehavior remains unchanged.Risk assessment
General Guidelines
azdev style vm-repairlocally?python scripts/ci/test_index.py -qlocally?Additional information
2.3.2.--yesand preserving them with--no-cleanup.src/index.json; the publication automation will update it after merge.