[vm] fix az vm boot-diagnostics get-boot-log TypeError with azure-mgmt-storage 25.0.0 - #33727
[vm] fix az vm boot-diagnostics get-boot-log TypeError with azure-mgmt-storage 25.0.0#33727Aditya Pujara (a0x1ab) with Copilot wants to merge 13 commits into
az vm boot-diagnostics get-boot-log TypeError with azure-mgmt-storage 25.0.0#33727Conversation
|
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
az vm boot-diagnostics get-boot-log TypeError with azure-mgmt-storage 25.0.0
There was a problem hiding this comment.
Automated CI Review — PR #33727
CI has 2 failing checks on the current head commit that need to be resolved:
- Test Extensions Loading Python314 — failed. See the Azure DevOps run: https://dev.azure.com/azclitools/5147fa83-336e-44ef-bbe0-c86b8ae86cbb/_build/results?buildId=329676
- Test Homebrew Formula — failed. Same build: https://dev.azure.com/azclitools/5147fa83-336e-44ef-bbe0-c86b8ae86cbb/_build/results?buildId=329676
71 of 73 completed checks passed; 17 checks are still pending/running.
Note: the issue-sentinel live-test dispatch could not be triggered this round due to a token-permission restriction (403 Resource not accessible) on the automation side — this is unrelated to the PR itself and will be retried automatically once the underlying CI failures above are addressed.
Please investigate the two failing checks above (Test Extensions Loading Python314 and Test Homebrew Formula) and push a fix.
Posted by agent-assist (autonomous bug-fix pipeline).
|
Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33727 (review) and push a fix. Posted by agent-assist (autonomous bug-fix pipeline). |
… update HISTORY.rst
Investigated the two failing checks. Here's what I found:
However, while investigating I found two additional broken
Also added a Fixes pushed in commit |
There was a problem hiding this comment.
❌ CI Failures — Test Mock Needs Update
The following check suites failed:
Azure.azure-cli Full Test (Automation Full Test Python312 Profile Latest instance3)Azure.azure-cli Full Test (Automation Full Test Python314 Profile Latest instance3)
Root Cause
batchai/custom.py was correctly updated to use .keys_property instead of .keys, but the corresponding batchai unit test mock was not updated.
In src/azure-cli/azure/cli/command_modules/batchai/tests/latest/test_batchai_custom.py, the helper function _get_mock_storage_accounts_and_keys (line 60) still creates a namedtuple with the old field name:
Keys = collections.namedtuple('Keys', 'keys') # ← still 'keys', not 'keys_property'When the code now accesses keys_list_result.keys_property, it gets an AttributeError because the namedtuple only has a keys field.
Fix Required
Update _get_mock_storage_accounts_and_keys in test_batchai_custom.py to use keys_property instead of keys:
# Change this:
Keys = collections.namedtuple('Keys', 'keys')
# To this:
Keys = collections.namedtuple('Keys', 'keys_property')This aligns the test mock with the updated batchai/custom.py code that now accesses .keys_property (compatible with azure-mgmt-storage >= 25.0.0).
Posted by agent-assist (autonomous bug-fix pipeline).
|
Copilot the automated CI and live-test review on this PR found failures. Please look into the requested changes here: #33727 (review) and push a fix. Posted by agent-assist (autonomous bug-fix pipeline). |
…s offsets Co-authored-by: JaysonTaiMicrosoft <268525319+JaysonTaiMicrosoft@users.noreply.github.com>
|
Started a Copilot task using Posted by agent-assist (autonomous bug-fix pipeline). |
Co-authored-by: JaysonTaiMicrosoft <268525319+JaysonTaiMicrosoft@users.noreply.github.com>
|
Started a Copilot task using Posted by agent-assist (autonomous bug-fix pipeline). |
…diagnostics test Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Live test results —
|
There was a problem hiding this comment.
Live Test Result — Failing
The live-test run for this PR failed on an existing test unrelated to the boot-diagnostics fix:
Failed:
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_aliasThis asserts the last entry returned byself.assertTrue('lts' in result[-1]['sku']) E AssertionError: False is not trueaz vm image list --offer ubuntu(served from the offline curated image list) has an'lts'SKU. The offline image list data appears to have drifted so the last Ubuntu/Canonical entry no longer hasltsin its SKU name.
Passed:
- All 5
TestVMBootLogunit tests (the actual target of this fix) passed:
test_vm_boot_log_falls_back_to_keys,test_vm_boot_log_handle_unicode,
test_vm_boot_log_init_storage_sdk,test_vm_boot_log_uses_keys_property,
test_vm_boot_log_writer_returns_written_length. - All
test_batchai_customtests (87 tests) passed.
CI: all required checks passed (0 failed, 0 pending).
Run: https://github.com/Azure/issue-sentinel/actions/runs/32091767979
Please investigate test_vm_image_list_by_alias — it was swept into this live-test run because it lives in the same file (test_vm_commands.py) as the boot-diagnostics tests, but the assertion failure ('lts' not in result[-1]['sku']) looks unrelated to this PR's change and may reflect stale/updated offline VM image list data rather than a regression caused by this fix. If it's confirmed pre-existing/unrelated, update the assertion to match current data or mark it appropriately; otherwise fix any real regression it uncovers.
Posted by agent-assist (autonomous bug-fix pipeline).
|
Started a Copilot task using Posted by agent-assist (autonomous bug-fix pipeline). |
…date order-dependent assertions Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Live test results —
|
Live test results —
|
There was a problem hiding this comment.
Automated CI and Live-Test Review — Failures Found
PR: [vm] fix \az vm boot-diagnostics get-boot-log` TypeError with azure-mgmt-storage 25.0.0(headff97e26`)
Live test (azdev test --live)
- ❌ Run failed: https://github.com/Azure/issue-sentinel/actions/runs/32096027837
- The live-test workflow ran the changed test file(s) for this PR against real Azure resources and the job's test step reported failures. The workflow already posted its own detailed comment with the recorded output on this PR — please check that comment for the exact assertion/traceback.
CI checks (3 failed / 20 total)
- ❌ Azure.azure-cli Full Test — https://github.com/Azure/azure-cli/runs/95595636572 (
Build #20260818.9 had test failures) - ❌ Azure.azure-cli Full Test (Automation Full Test Python314 Profile Latest instance2) — https://github.com/Azure/azure-cli/runs/95594767659
- ❌ Azure.azure-cli Full Test (Automation Full Test Python312 Profile Latest instance2) — https://github.com/Azure/azure-cli/runs/95594469950
All other CI checks passed (linter, style, CLA, and the remaining 15 test shards).
Requested action
Please investigate why the vm module's boot-diagnostics get-boot-log fix causes the live test and the two Automation Full Test shards above to fail, fix the regression (or update the affected tests/recordings if the failure is a legitimate behavior change), and push a commit so CI and the live test can be re-run.
Posted by agent-assist (autonomous bug-fix pipeline).
|
Started a Copilot task using Posted by agent-assist (autonomous bug-fix pipeline). |
…lback - Add 4 missing HTTP interactions to test_vm_boot_diagnostics.yaml for the custom-storage path (get-boot-log-uris + get-boot-log), fixing CI Full Test instance2 playback failures - Update batchai test mock to include both keys_property and legacy keys attributes, ensuring the fallback path is covered Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
|
Automated sensitive-information remediation ran on this pull request.
Agent Assist does not modify source files. The PR creator must remove or replace each suspected value at the linked line:
If a credential was exposed, rotate or revoke it immediately. Detected values are never copied into this comment. ✅ Confirm the finding · ❌ Dispute the finding GitHub only supports a fixed reaction set, so 👍 represents ✅ and 👎 represents ❌. The bot-created reactions are only poll choices. Posted by agent-assist (autonomous bug-fix pipeline). |
🤖 PR Validation — ️✔️ All clear
Related command
az vm boot-diagnostics get-boot-logDescription
In
azure-mgmt-storage25.0.0,StorageAccountListKeysResultnow inherits fromMutableMapping, causing.keysto shadow theStorageAccountKeylist with the built-inMutableMapping.keys()method. The keys list was renamed tokeys_propertyin the regenerated model.vm/custom.py: Inget_boot_log, changekeys.keys[0].value→keys.keys_property[0].valuewhen retrieving the storage account credential for a custom (non-managed) boot diagnostics storage account.test_custom_vm_commands.py: Addtest_vm_boot_log_uses_keys_propertyto assert the correct attribute is used when constructing theBlobClient.Testing Guide
History Notes
[vm]
az vm boot-diagnostics get-boot-log: FixTypeError: 'method' object is not subscriptablewhen VM uses a custom storage account for boot diagnostics (regression with azure-mgmt-storage 25.0.0)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.