[Compute] Fix issue #31685: az vm/vmss update Fix error with NoneType object has no attribute mode when update wireserver profile#31855
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @Jing-song, |
️✔️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
This PR fixes issue #31685 where az vm update and az vmss update commands fail with "'NoneType' object has no attribute 'mode'" error when updating wireserver profile settings. The fix ensures that wireserver and imds settings objects are properly initialized before attempting to access their attributes.
- Adds proper null checks and initialization for wireserver and imds settings in proxy agent configurations
- Updates test cases to validate the fix with proper error handling expectations
- Refactors test setup to use unique resource names to avoid conflicts
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/vm/custom.py | Fixes the core issue by adding null checks and conditional property setting for proxy agent settings in both VM and VMSS update functions |
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py | Updates test cases to validate the fix and improves test isolation with unique resource names |
| wire_server=wire_server, imds=imds) | ||
| else: | ||
| if vmss.virtual_machine_profile.security_profile.proxy_agent_settings.wire_server is None: | ||
| vmss.virtual_machine_profile.security_profile.wire_server = wire_server |
There was a problem hiding this comment.
This line incorrectly assigns wire_server to security_profile.wire_server instead of security_profile.proxy_agent_settings.wire_server. It should be vmss.virtual_machine_profile.security_profile.proxy_agent_settings.wire_server = wire_server.
| vmss.virtual_machine_profile.security_profile.wire_server = wire_server | |
| vmss.virtual_machine_profile.security_profile.proxy_agent_settings.wire_server = wire_server |
az vm/vmss update Fix error with 'NoneType' object has no attribute 'mode' when update wireserver profileaz vm/vmss update Fix error with NoneType object has no attribute mode when update wireserver profile
Related command
az vm/vmss updateDescription
close #31685
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.