azure-cli
azure-cli copied to clipboard
az aks is broken after `az extension update --name aks-preview`
Describe the bug
I am trying to enable NodeAutoProvisioning (Karpenter) for AKS using az aks update --resource-group aks-cilium-karpenter --name aks-cilium-karpeter --node-provisioning-mode Auto.
This command required the following preview extensions. After adding and updating the extension, any az aks commands does not work.
➜ ~ az extension add --name aks-preview
az extension update --name aks-preview
Related command
➜ ~ az aks list
➜ ~ az aks update --resource-group aks-cilium-karpenter --name aks-cilium-karpeter --node-provisioning-mode Auto
Errors
The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute '__dict__'
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 564, in execute
self.commands_loader.load_arguments(command)
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 527, in load_arguments
loader.load_arguments(command) # this adds entries to the argument registries
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/psetlur/.azure/cliextensions/aks-preview/azext_aks_preview/__init__.py", line 45, in load_arguments
load_arguments(self, command)
File "/Users/psetlur/.azure/cliextensions/aks-preview/azext_aks_preview/_params.py", line 433, in load_arguments
k8s_support_plans = self.get_models(
^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/__init__.py", line 782, in get_models
return get_sdk(self.cli_ctx, resource_type, *attr_args, mod='models', operation_group=operation_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/profiles/__init__.py", line 91, in get_sdk
return _sdk_get_versioned_sdk(cli_ctx.cloud.profile, resource_type, *attr_args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 694, in get_versioned_sdk
sdk_path = get_versioned_sdk_path(api_profile, resource_type, operation_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 686, in get_versioned_sdk_path
api_version = getattr(api_version, operation_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 481, in __getattr__
self._resolve()
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/profiles/_shared.py", line 468, in _resolve
for operation_group_name, operation_type in self._client_type.__dict__.items():
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute '__dict__'. Did you mean: '__dir__'?
Issue script & Debug output
n/a
Expected behavior
The cluster should be updated with NAP and az aks list should be able to list the cluster as required.
Environment Summary
➜ ~ az --version
azure-cli 2.65.0
core 2.65.0
telemetry 1.1.0
Extensions:
account 0.2.5
aks-preview 9.0.0b6
Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1
Python location '/usr/local/Cellar/azure-cli/2.65.0_1/libexec/bin/python'
Extensions directory '/Users/psetlur/.azure/cliextensions'
Python (Darwin) 3.12.7 (main, Oct 1 2024, 02:05:46) [Clang 15.0.0 (clang-1500.3.9.4)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
No response
Thank you for opening this issue, we will look into it.
Here are some similar issues that might help you. Please check if they can solve your problem.
- #19450
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dyu1208, @FumingZhang, @andyliuliming.
Something that could be related to this issue. I am also unable to ssh into a VM using a bastion host.
➜ ~ az network bastion ssh --name aks-vnet-23126944-bastion --resource-group MC_aks-cilium-karpenter_aks_cilium-karpenter_westus --target-resource-id /subscriptions/xxxxxxxx/resourceGroups/aks-clium-karpenter/providers/Microsoft.Compute/virtualMachines/kubectl-client --auth-type ssh-key --username azureuser
The command failed with an unexpected error. Here is the traceback:
No module named 'pkg_resources'
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 666, in execute
raise ex
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 733, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__
return self.handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/Users/psetlur/.azure/cliextensions/bastion/azext_bastion/custom.py", line 145, in ssh_bastion_host
_test_extension(SSH_EXTENSION_NAME)
File "/Users/psetlur/.azure/cliextensions/bastion/azext_bastion/custom.py", line 78, in _test_extension
from pkg_resources import parse_version
ModuleNotFoundError: No module named 'pkg_resources'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
I'm also seeing this exact issue 'NoneType' object has no attribute '__dict_ when attempting to use az aks
Something that could be related to this issue. I am also unable to ssh into a VM using a bastion host.
➜ ~ az network bastion ssh --name aks-vnet-23126944-bastion --resource-group MC_aks-cilium-karpenter_aks_cilium-karpenter_westus --target-resource-id /subscriptions/xxxxxxxx/resourceGroups/aks-clium-karpenter/providers/Microsoft.Compute/virtualMachines/kubectl-client --auth-type ssh-key --username azureuser The command failed with an unexpected error. Here is the traceback: No module named 'pkg_resources' Traceback (most recent call last): File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 666, in execute raise ex File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 733, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 703, in _run_job result = cmd_copy(params) ^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 336, in __call__ return self.handler(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/azure-cli/2.65.0_1/libexec/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) ^^^^^^^^^^^^^^^^^^ File "/Users/psetlur/.azure/cliextensions/bastion/azext_bastion/custom.py", line 145, in ssh_bastion_host _test_extension(SSH_EXTENSION_NAME) File "/Users/psetlur/.azure/cliextensions/bastion/azext_bastion/custom.py", line 78, in _test_extension from pkg_resources import parse_version ModuleNotFoundError: No module named 'pkg_resources' To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
Weird, setuptools is missing.
I think this issue is caused by the 3.12 bump in homebrew. Wait for homebrew member's response: https://github.com/Homebrew/homebrew-core/pull/194884#issuecomment-2425815824
From my perspective, it could be caused by: https://github.com/Azure/azure-cli/issues/30148
I'm also seeing this exact issue
'NoneType' object has no attribute '__dict_when attempting to useaz aks
Oddly enough, I was able to get mine working by running az extension remove --name aks-preview.
Testing to see if it was gone showed that it was still there and actually working. Not sure what that means.
I also ran into this problem. Was fixed with the latest update homebrew azure-cli (2.65.0_2).
brew upgrade azure-cli fixed the issue. Thank you for the quick fix!