{Compute} az vm install-patches: Migrate command to aaz-based implementation#32763
{Compute} az vm install-patches: Migrate command to aaz-based implementation#32763william051200 wants to merge 5 commits intoAzure:devfrom
az vm install-patches: Migrate command to aaz-based implementation#32763Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
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
Migrates az vm install-patches from the mgmt-plane azure-mgmt-compute implementation to an AAZ-based implementation within the VM command module.
Changes:
- Replaced the existing
client.begin_install_patches(...)path with a wrapper that invokes the generated AAZInstallPatchescommand. - Updated command registration for
vm install-patchesto no longer require an SDK client factory. - Added VM guest patching enums to
_vm_utils.pyand switched argument enum sources in_params.py.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/custom.py |
Replaces the SDK-based implementation with an AAZ command invocation wrapper. |
src/azure-cli/azure/cli/command_modules/vm/commands.py |
Re-registers vm install-patches under a command group that doesn’t inject an SDK client. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_install_patches.py |
Adds the generated AAZ command implementation for vm install-patches. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/__init__.py |
Exposes the new generated AAZ InstallPatches command via package imports. |
src/azure-cli/azure/cli/command_modules/vm/_vm_utils.py |
Adds local enums for reboot setting and patch classifications. |
src/azure-cli/azure/cli/command_modules/vm/_params.py |
Switches argument enums for vm install-patches to the new local enums. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from .aaz.latest.vm import Update as UpdateVM | ||
|
|
||
| from .generated.custom import * # noqa: F403, pylint: disable=unused-wildcard-import,wildcard-import | ||
| from ..resource.commands import resource_privatelinksassociation_sdk |
There was a problem hiding this comment.
resource_privatelinksassociation_sdk is imported but not used anywhere in this module. This will trigger unused-import linting and adds unnecessary coupling to the resource module; please remove the import (or use it if it was intended).
| from ..resource.commands import resource_privatelinksassociation_sdk |
| with self.command_group('vm') as g: | ||
| g.custom_command('install-patches', 'install_vm_patches', supports_no_wait=True) |
There was a problem hiding this comment.
The command registration removed min_api (previously 2020-12-01). Since the new implementation calls the AAZ operation with a fixed Compute api-version (2024-11-01), the command can become available in profiles/clouds that don't support that API version and then fail at runtime. Please add an appropriate min_api gate here (ideally matching the AAZ operation version you are using) to preserve the previous availability behavior.
az vm install-patches: Migrate command to aaz-based implementation
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
please resolve the code conflict |
|
|
||
| @register_command( | ||
| "vm install-patches", | ||
| ) |
There was a problem hiding this comment.
if the command would still be defined in commands.py file after migrating the implementation to aaz-based, it would be better to unregister the command in the generated aaz file
Related command
az vm install-patchesDescription
Migration from mgmt.compute to aaz-based
aaz Azure/aaz#941
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.