{Compute} az capacity reservation group: Migrate command group to aaz-based implementation#32910
{Compute} az capacity reservation group: Migrate command group to aaz-based implementation#32910william051200 wants to merge 4 commits intoAzure:devfrom
az capacity reservation group: Migrate command group to aaz-based implementation#32910Conversation
❌AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
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>
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
Pull request overview
Migrates az capacity reservation group’s create/update/show implementations in the VM command module from the Compute management SDK path to AAZ-based commands, aligning with ongoing AAZ adoption in this area of the codebase.
Changes:
- Replaced SDK client usage in
create_capacity_reservation_group,update_capacity_reservation_group, andshow_capacity_reservation_groupwith calls into AAZ command classes. - Updated command registration for
capacity reservation groupto remove the SDK command type/client factory wiring. - Added generated AAZ command implementations for capacity reservation group
create/show/updateand exported them from the AAZ package.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/custom.py |
Switches create/update/show custom handlers to invoke AAZ commands and adapts argument shaping (e.g., sharing profile). |
src/azure-cli/azure/cli/command_modules/vm/commands.py |
Registers capacity reservation group commands without SDK command_type/client_factory. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/group/_create.py |
Adds generated AAZ Create command for capacity reservation groups. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/group/_show.py |
Adds generated AAZ Show command for capacity reservation groups. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/group/_update.py |
Adds generated AAZ Update command for capacity reservation groups. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/group/__init__.py |
Exports the new generated AAZ commands from the package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
|
|
||
| class Create(AAZCommand): | ||
| """Create operation to create or update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. |
There was a problem hiding this comment.
The Create command docstring says "When updating a capacity reservation group, only tags may be modified", but this command also accepts and sends zones and sharing_profile. Please update the generated description to avoid misleading future maintainers about what this command actually supports.
| """Create operation to create or update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. | |
| """Create operation to create or update a capacity reservation group. Please refer to https://aka.ms/CapacityReservation for more details. |
|
|
||
|
|
||
| class Update(AAZCommand): | ||
| """Update operation to create or update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. |
There was a problem hiding this comment.
The Update command docstring says "only tags may be modified", but this command schema and JSON update logic also handle sharing_profile (and even exposes zones). Please update the description (or regenerate from the correct swagger) so the documentation matches the supported update surface.
| """Update operation to create or update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. Please refer to https://aka.ms/CapacityReservation for more details. | |
| """Update operation to create or update a capacity reservation group. When updating a capacity reservation group, you can modify tags and other updatable properties. Please refer to https://aka.ms/CapacityReservation for more details. |
| if tags: | ||
| command_args['tags'] = tags | ||
|
|
There was a problem hiding this comment.
update_capacity_reservation_group only forwards tags when it is truthy. This breaks the common CLI behavior of clearing tags via --tags "", which is parsed as an empty dict and should be sent to the service to remove existing tags. Use an explicit tags is not None check (and forward empty dicts) so tag clearing continues to work after the AAZ migration.
|
|
||
| with self.command_group('capacity reservation group', capacity_reservation_groups_sdk, min_api='2021-04-01', | ||
| client_factory=cf_capacity_reservation_groups) as g: | ||
| with self.command_group('capacity reservation group') as g: |
There was a problem hiding this comment.
The command group no longer uses capacity_reservation_groups_sdk / cf_capacity_reservation_groups, so the capacity_reservation_groups_sdk = CliCommandType(...) definition (and the corresponding import) in this module become unused and may trigger lint failures. Remove the unused CliCommandType and import, or rewire the command group to use them if still needed.
Related command
az capacity reservation group createaz capacity reservation group updateaz capacity reservation group showDescription
Migration from mgmt.compute to aaz-based
aaz Azure/aaz#954
Testing Guide
History Notes
This 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.