Fix AttributeError in az extension update when extension has missing metadata from partial install#33361
Draft
Copilot wants to merge 3 commits into
Draft
Fix AttributeError in az extension update when extension has missing metadata from partial install#33361Copilot wants to merge 3 commits into
az extension update when extension has missing metadata from partial install#33361Copilot wants to merge 3 commits into
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
…tall Guard get_version() in WheelExtension and DevExtension against None metadata. Add warning in update_extension() when metadata is missing. Fix rollback message to handle unknown version gracefully. Fixes: az extension update crashes with AttributeError when extension was partially installed (interrupted mid-way). Agent-Logs-Url: https://github.com/Azure/azure-cli/sessions/defa69dc-f897-4a91-975d-3bb1ca805404 Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Azure/azure-cli/sessions/defa69dc-f897-4a91-975d-3bb1ca805404 Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue with az extension update for azure-devops
Fix AttributeError in May 12, 2026
az extension update when extension has missing metadata from partial install
Collaborator
|
extension update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
az extension updatecrashes withAttributeError: 'NoneType' object has no attribute 'get'when an extension directory exists but metadata is absent — e.g., after interruptingaz extension addmid-way. Root cause:get_version()unconditionally callsself.metadata.get('version')without aNoneguard.Changes
extension/__init__.py— Guardget_version()in bothWheelExtensionandDevExtensionagainstNonemetadata:extension/operations.py—update_extension():logger.warningwhencur_version is None, indicating the extension may be partially installed and the update will attempt to repair it"unknown"instead ofNonewhen version is unavailableTesting Guide
Unit tests added:
test_wheel_get_version_with_none_metadata—get_version()returnsNonewhen metadata isNonetest_update_extension_with_corrupted_metadata—update_extension()logs warning and successfully reinstalls whenget_version()returnsNoneHistory Notes
[Core]
az extension update: FixAttributeErrorcrash when extension has missing or corrupted metadata due to interrupted installationThis 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.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
azcliprod.blob.core.windows.net/usr/bin/python python -m pytest src/azure-cli-core/azure/cli/core/tests/test_extension.py -v(dns block)If you need me to access, download, or install something from one of these locations, you can either: