{Compute} az capacity reservation: Migrate to Code Gen based#31794
{Compute} az capacity reservation: Migrate to Code Gen based#31794zhoxing-ms merged 2 commits intoAzure:devfrom
az capacity reservation: Migrate to Code Gen based#31794Conversation
️✔️AzureCLI-FullTest
|
❌AzureCLI-BreakingChangeTest
Please submit your Breaking Change Pre-announcement ASAP if you haven't already. Please note:
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
This PR migrates capacity reservation commands (az capacity reservation) from manual implementation to code generation (AAZ) based approach. The migration includes updating test methods to comprehensively test the create/update/show operations for capacity reservations and moving from the old centraluseuap region to eastus2euap.
Key Changes
- Migrated capacity reservation commands to use AAZ-based code generation
- Added comprehensive test coverage for capacity reservation create/update/show operations
- Updated test location from centraluseuap to eastus2euap
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test_vm_commands.py | Renamed and expanded test function to cover create/update/show operations |
| test_capacity_reservation_operations.yaml | New recording file for the expanded test operations |
| test_capacity_reservation_list_delete.yaml | Removed old recording file (deleted) |
| capacity_reservation.py | New AAZ-based implementation for update and show operations |
Comments suppressed due to low confidence (1)
| instance = _CapacityReservationShow(cli_ctx=self.cli_ctx)(command_args={ | ||
| "capacity_reservation_group": args.capacity_reservation_group, | ||
| "capacity_reservation_name": args.capacity_reservation_name, | ||
| "resource_group": args.resource_group, | ||
| }) | ||
| args.tags = instance.get("tags", None) |
There was a problem hiding this comment.
Consider handling potential exceptions from the Show command execution. If the show operation fails, the update operation would fail with an unclear error. Add proper error handling to provide better user experience.
| instance = _CapacityReservationShow(cli_ctx=self.cli_ctx)(command_args={ | |
| "capacity_reservation_group": args.capacity_reservation_group, | |
| "capacity_reservation_name": args.capacity_reservation_name, | |
| "resource_group": args.resource_group, | |
| }) | |
| args.tags = instance.get("tags", None) | |
| try: | |
| instance = _CapacityReservationShow(cli_ctx=self.cli_ctx)(command_args={ | |
| "capacity_reservation_group": args.capacity_reservation_group, | |
| "capacity_reservation_name": args.capacity_reservation_name, | |
| "resource_group": args.resource_group, | |
| }) | |
| args.tags = instance.get("tags", None) | |
| except Exception as ex: | |
| logger.error("Failed to retrieve capacity reservation details: %s", str(ex)) | |
| raise RuntimeError("Unable to retrieve capacity reservation details. Please check the provided arguments and try again.") from ex |
Related command
az capacity reservation create/update/showDescription
aaz PR: Azure/aaz#806
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.