az upgrade error: 'NoneType' object has no attribute 'name'/ModuleNotFoundError: No module named 'jmespath'
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62
**Describe the bug**
When running az upgrade to upgrade CLI version 2.28.0 in the Azure devops environment using the AzureCLI@2 task I get the following error:
```
Preparing to unpack .../azure-cli_2.36.0-1~bionic_all.deb ...
Unpacking azure-cli (2.36.0-1~bionic) over (2.28.0-1~bionic) ...
Setting up azure-cli (2.36.0-1~bionic) ...
WARNING: Auto upgrade failed. name 'exit_code' is not defined
Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/util/custom.py", line 149, in upgrade_version
File "/opt/az/lib/python3.6/importlib/__init__.py", line 166, in reload
File "", line 600, in _exec
AttributeError: 'NoneType' object has no attribute 'name'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/az/lib/python3.6/runpy.py", line 193, in _run_module_as_main
File "/opt/az/lib/python3.6/runpy.py", line 85, in _run_code
File "/opt/az/lib/python3.6/site-packages/azure/cli/__main__.py", line 48, in
File "/opt/az/lib/python3.6/site-packages/azure/cli/__main__.py", line 35, in cli_main
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 243, in invoke
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 137, in exception_handler
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/util.py", line 57, in handle_exception
ModuleNotFoundError: No module named 'jmespath'
Please let us know how we are doing: https://aka.ms/azureclihats
and let us know if you're interested in trying out our newest features: https://aka.ms/CLIUXstudy
azure-cli 2.36.0
core 2.36.0
telemetry 1.0.6
Dependencies:
msal 1.17.0
azure-mgmt-resource 20.0.0
Python location '/opt/az/bin/python3'
Extensions directory '/__w/_temp/.azclitask/cliextensions'
Python (Linux) 3.8.13 (default, Apr 22 2022, 04:53:04)
[GCC 7.5.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
```
**To Reproduce**
In Azure devops:
```bash
- task: AzureCLI@2
displayName: DisplayName
name: mytask
inputs:
azureSubscription: '$(subscriptionServiceConnection)'
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az upgrade --yes
az --version
```
**Expected behavior**
I expect the upgrade to complete without an error.
**Environment summary**
Azure devops linux pool
Contributor guide
Assessment
This issue has not been assessed yet.