{Compute} az vmss diagnostics: Migrate command group to aaz-based implementation#32921
{Compute} az vmss diagnostics: Migrate command group to aaz-based implementation#32921william051200 wants to merge 3 commits intoAzure:devfrom
az vmss diagnostics: Migrate command group to aaz-based implementation#32921Conversation
️✔️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 the az vmss diagnostics command group (set / get-default-config) from the mgmt.compute SDK-backed command group registration to an AAZ-based registration, and updates the VMSS diagnostics extension setter to fetch VMSS via AAZ.
Changes:
- Register
vmss diagnosticswithout thecompute_vmss_sdkcommand type (AAZ migration pattern). - Update
set_vmss_diagnostics_extensionto retrieve VMSS viaget_vmss_by_aazand use_is_linux_os_aazfor OS detection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/custom.py |
Switch VMSS retrieval to AAZ and adjust VMSS dict access paths for diagnostics extension logic. |
src/azure-cli/azure/cli/command_modules/vm/commands.py |
Move vmss diagnostics command group registration off the SDK command type to support AAZ-based implementation. |
Comments suppressed due to low confidence (1)
src/azure-cli/azure/cli/command_modules/vm/custom.py:5120
extscomes fromVMSSShow(AAZ) and is a list of dicts, but the incompatibility check uses attribute access (e.name,e.type_handler_version). This will raiseAttributeErrorat runtime and the check will never work. Update the predicate to use dict keys (e.g.e.get('name')ande.get('typeHandlerVersion')for the camelCase VMSSShow output, or convert to snake_case first and then usetype_handler_version).
major_ver = extension_mappings[_LINUX_DIAG_EXT]['version'].split('.', maxsplit=1)[0]
# For VMSS, we don't do auto-removal like VM because there is no reliable API to wait for
# the removal done before we can install the newer one
if next((e for e in exts if e.name == _LINUX_DIAG_EXT and
not e.type_handler_version.startswith(major_ver + '.')), None):
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| result = LongRunningOperation(cmd.cli_ctx)(poller) | ||
| UpgradeMode = cmd.get_models('UpgradeMode') | ||
| if vmss.upgrade_policy.mode == UpgradeMode.manual: | ||
| if vmss.get('upgradePolicy', {}).get('upgradePolicy') == UpgradeMode.MANUAL.value: |
There was a problem hiding this comment.
The manual upgrade policy check is using vmss.get('upgradePolicy', {}).get('upgradePolicy'), but the VMSS model has upgradePolicy.mode (and this file already uses .get('mode') elsewhere). As written, this condition will never be true, so instances won’t be updated for manual upgrade mode. Use vmss.get('upgradePolicy', {}).get('mode') == UpgradeMode.MANUAL.value (camelCase output) instead.
| if vmss.get('upgradePolicy', {}).get('upgradePolicy') == UpgradeMode.MANUAL.value: | |
| if vmss.get('upgradePolicy', {}).get('mode') == UpgradeMode.MANUAL.value: |
Related command
az vmss diagnostics setaz vmss diagnostics get-default-configDescription
Migration from mgmt.compute to aaz-based
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.