Azure-cli: argument of type 'NoneType' is not iterable when running az aks enable-addons

Created on 2 Dec 2019  Â·  21Comments  Â·  Source: Azure/azure-cli

Describe the bug

Getting this error when running az aks enable-addons after I followed the instructions from azure dashboard :

image

The previous command that failed for me was az aks browse --resource-group with the following error :
The kube-dashboard addon was disabled for this managed cluster. To use "az aks browse" first enable the add-on by running "az aks enable-addons --addons kube-dashboard".

Command Name
az aks enable-addons

Errors:

argument of type 'NoneType' is not iterable
Traceback (most recent call last):
Temp\pip-install-mjd5h3hf\knack\knack\cli.py, ln 206, in invoke
azure\cli\core\commands\__init__.py, ln 603, in execute
azure\cli\core\commands\__init__.py, ln 661, in _run_jobs_serially
azure\cli\core\commands\__init__.py, ln 654, in _run_job
Local\Temp\pip-install-mjd5h3hf\six\six.py, ln 696, in reraise
azure\cli\core\commands\__init__.py, ln 631, in _run_job
azure\cli\core\commands\__init__.py, ln 306, in __call__
azure-cli-core\azure\cli\core\__init__.py, ln 487, in default_command_handler
azure\cli\command_modules\acs\custom.py, ln 1845, in aks_enable_addons
azure\cli\command_modules\acs\custom.py, ln 2488, in _ensure_container_insights_for_monitoring
TypeError: argument of type 'NoneType' is not iterable

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • az aks enable-addons --addons {} --resource-group {} --name {}

Environment Summary

Windows-10-10.0.17763-SP0
Python 3.6.6
Shell: cmd.exe

azure-cli 2.0.77

Additional Context


AKS Service Attention

Most helpful comment

The proposed fix has been merged into the AKS-preview extension and core build for the S166 sprint. The core release is set for 3/10.

https://github.com/Azure/azure-cli/milestone/83

All 21 comments

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/aks-pm

Any update?

@AmitBaranes can you share the command you ran? I am unable to reproduce with the command provided in the error message.

➜  ~ az aks enable-addons --addons kube-dashboard -g myresourcegroup -n newazcluster

I ran into the same issue, when I try to run the same command I get the following output:

The command failed with an unexpected error. Here is the traceback:

argument of type 'NoneType' is not iterable
Traceback (most recent call last):
knack\knack\cli.py", line 206, in invoke
azure-cli-core\azure\cli\core\commands\__init__.py", line 603, in execute
azure-cli-core\azure\cli\core\commands\__init__.py", line 661, in _run_jobs_serially
azure-cli-core\azure\cli\core\commands\__init__.py", line 654, in _run_job
six\six.py", line 693, in reraise
azure-cli-core\azure\cli\core\commands\__init__.py", line 631, in _run_job
azure-cli-core\azure\cli\core\commands\__init__.py", line 306, in __call__
azure-cli-core\azure\cli\core\__init__.py", line 485, in default_command_handler
azure-cli\azure\cli\command_modules\acs\custom.py", line 1843, in aks_enable_addons
azure-cli\azure\cli\command_modules\acs\custom.py", line 2482, in _ensure_container_insights_for_monitoring
TypeError: argument of type 'NoneType' is not iterable

I ran into the same issue, when I try to run the same command I get the following output:

The command failed with an unexpected error. Here is the traceback:

argument of type 'NoneType' is not iterable
Traceback (most recent call last):
knack\knack\cli.py", line 206, in invoke
azure-cli-core\azure\cli\core\commands\__init__.py", line 603, in execute
azure-cli-core\azure\cli\core\commands\__init__.py", line 661, in _run_jobs_serially
azure-cli-core\azure\cli\core\commands\__init__.py", line 654, in _run_job
six\six.py", line 693, in reraise
azure-cli-core\azure\cli\core\commands\__init__.py", line 631, in _run_job
azure-cli-core\azure\cli\core\commands\__init__.py", line 306, in __call__
azure-cli-core\azure\cli\core\__init__.py", line 485, in default_command_handler
azure-cli\azure\cli\command_modules\acs\custom.py", line 1843, in aks_enable_addons
azure-cli\azure\cli\command_modules\acs\custom.py", line 2482, in _ensure_container_insights_for_monitoring
TypeError: argument of type 'NoneType' is not iterable

@alinareti I try with version 2.0.66, it works well, looks like it's a cli issue.

@AmitBaranes can you share the command you ran? I am unable to reproduce with the command provided in the error message.

➜  ~ az aks enable-addons --addons kube-dashboard -g myresourcegroup -n newazcluster

getting this exception :
image

I have a same exception after creation of new aks cluster

I get the exact same issue. However, downgrading to v2.0.66 did not help for me @andyzhangx

i am also getting same issue

The command failed with an unexpected error. Here is the traceback:

argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/Users/amolshende/lib/azure-cli/lib/python2.7/site-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/Users/amolshende/lib/azure-cli/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 603, in execute
    raise ex
TypeError: argument of type 'NoneType' is not iterable

To open an issue, please run: 'az feedback'

What Andy mentioned is we can't repro that with either 2.0.66 or 2.0.77

image

I see some outputs calling out python 2.7 and CLI 2.0.77 should be using python3

Could you check you are all using the latest CLI and the right python version is being referenced ?

az --version should also tell you the python location for you to check.

additionally could you run with --debug?

I uninstalled azure-cli which was pointing to python2.7 and re-installed it

Amols-MacBook-Pro:lib amolshende$ az --version
azure-cli                         2.0.78

command-modules-nspkg              2.0.3
core                              2.0.78
nspkg                              3.0.4
telemetry                          1.0.4

Python location '/usr/local/Cellar/azure-cli/2.0.78/libexec/bin/python'
Extensions directory '/Users/amolshende/.azure/cliextensions'

Python (Darwin) 3.7.5 (default, Nov  1 2019, 02:16:38)
[Clang 10.0.0 (clang-1000.11.45.5)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.

Still i am getting error

az aks enable-addons --addons kube-dashboard --resource-group firstapp-resources --name hello
The command failed with an unexpected error. Here is the traceback:

argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 608, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 666, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 659, in _run_job
    six.reraise(*sys.exc_info())
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/six.py", line 696, in reraise
    raise value
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 636, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 306, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 490, in default_command_handler
    return op(**command_args)
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/command_modules/acs/custom.py", line 1844, in aks_enable_addons
    _ensure_container_insights_for_monitoring(cmd, instance.addon_profiles['omsagent'])
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/command_modules/acs/custom.py", line 2487, in _ensure_container_insights_for_monitoring
    if 'loganalyticsworkspaceresourceid' in addon.config:
TypeError: argument of type 'NoneType' is not iterable

To open an issue, please run: 'az feedback'

I get the same error with latest az (version output after the error below):

The command failed with an unexpected error. Here is the traceback:                                                                                                          

cli.azure.cli.core.util : argument of type 'NoneType' is not iterable                                                                                                        
Traceback (most recent call last):                                                                                                                                           
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\knack\knack\cli.py", line 206, in invoke                                                                   
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\commands\__init__.py", line 608, in execute                                  
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\commands\__init__.py", line 666, in _run_jobs_serially                       
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\commands\__init__.py", line 659, in _run_job                                 
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\six\six.py", line 696, in reraise                                                                          
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\commands\__init__.py", line 636, in _run_job                                 
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\commands\__init__.py", line 306, in __call__                                 
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\__init__.py", line 493, in default_command_handler                           
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli\azure\cli\command_modules\acs\custom.py", line 1844, in aks_enable_addons                        
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli\azure\cli\command_modules\acs\custom.py", line 2487, in _ensure_container_insights_for_monitoring
TypeError: argument of type 'NoneType' is not iterable                                                                                                                       
argument of type 'NoneType' is not iterable                                                                                                                                  
Traceback (most recent call last):                                                                                                                                           
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\knack\knack\cli.py", line 206, in invoke                                                                   
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\commands\__init__.py", line 608, in execute                                  
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\commands\__init__.py", line 666, in _run_jobs_serially                       
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\commands\__init__.py", line 659, in _run_job                                 
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\six\six.py", line 696, in reraise                                                                          
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\commands\__init__.py", line 636, in _run_job                                 
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\commands\__init__.py", line 306, in __call__                                 
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli-core\azure\cli\core\__init__.py", line 493, in default_command_handler                           
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli\azure\cli\command_modules\acs\custom.py", line 1844, in aks_enable_addons                        
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli\azure\cli\command_modules\acs\custom.py", line 2487, in _ensure_container_insights_for_monitoring
TypeError: argument of type 'NoneType' is not iterable

az --version returning:

azure-cli                         2.0.78                                                     

command-modules-nspkg              2.0.3                                                     
core                              2.0.78                                                     
nspkg                              3.0.4                                                     
telemetry                          1.0.4                                                     

Extensions:                                                                                  
azure-cli-iot-ext                  0.8.5                                                     
azure-devops                      0.13.0                                                     

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'                
Extensions directory 'C:\Users\james\.azure\cliextensions'                                   

Python (Windows) 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 02:47:15) [MSC v.1900 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal                                             



Your CLI is up-to-date.

Any update to this? I'm still seeing this error.

@mboersma any idea about this error? instance.addon_profiles['omsagent'] returns nil?

https://github.com/Azure/azure-cli/blob/ad8d70f5ea30bd0b3d271de360c190cd8de13578/src/azure-cli/azure/cli/command_modules/acs/custom.py#L1843-L1844

https://github.com/Azure/azure-cli/blob/ad8d70f5ea30bd0b3d271de360c190cd8de13578/src/azure-cli/azure/cli/command_modules/acs/custom.py#L2485-L2488

File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli\azure\cli\command_modules\acs\custom.py", line 1844, in aks_enable_addons                        
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-2ombfg7z\azure-cli\azure\cli\command_modules\acs\custom.py", line 2487, in _ensure_container_insights_for_monitoring

I'm also getting this error:

[Jan 17 11:20 AM][matt@ubuntu:/tmp/tmp]$ az aks enable-addons --addons kube-dashboard --resource-group aks --name aks-IAfrAhu9 --verbose
The command failed with an unexpected error. Here is the traceback:

argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 608, in execute
    raise ex
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 666, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 659, in _run_job
    six.reraise(*sys.exc_info())
  File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 636, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 306, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 493, in default_command_handler
    return op(**command_args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 1844, in aks_enable_addons
    _ensure_container_insights_for_monitoring(cmd, instance.addon_profiles['omsagent'])
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/acs/custom.py", line 2487, in _ensure_container_insights_for_monitoring
    if 'loganalyticsworkspaceresourceid' in addon.config:
TypeError: argument of type 'NoneType' is not iterable

To open an issue, please run: 'az feedback'
command ran in 2.180 seconds.
[Jan 17 11:21 AM][matt@ubuntu:/tmp/tmp]$ kubectl get pods -l k8s-app=kubernetes-dashboard
No resources found in default namespace.
[Jan 17 11:22 AM][matt@ubuntu:/tmp/tmp]$ az aks browse --resource-group aks --name aks-IAfrAhu9
The kube-dashboard addon was disabled for this managed cluster.
To use "az aks browse" first enable the add-on
by running "az aks enable-addons --addons kube-dashboard".
[Jan 17 11:25 AM][matt@ubuntu:/tmp/tmp]$ 

Same here az aks enable-addons --addons kube-dashboard --resource-group example-resources --name example-aks1 --verbose
The command failed with an unexpected error. Here is the traceback:

argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.0.75/libexec/lib/python3.7/site-packages/knack/cli.py", line 206, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/Cellar/azure-cli/2.0.75/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 603, in execute
raise ex
File "/usr/local/Cellar/azure-cli/2.0.75/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 661, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/local/Cellar/azure-cli/2.0.75/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 654, in _run_job
six.reraise(sys.exc_info())
File "/usr/local/Cellar/azure-cli/2.0.75/libexec/lib/python3.7/site-packages/six.py", line 693, in reraise
raise value
File "/usr/local/Cellar/azure-cli/2.0.75/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 631, in _run_job
result = cmd_copy(params)
File "/usr/local/Cellar/azure-cli/2.0.75/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 306, in __call__
return self.handler(
args, kwargs)
File "/usr/local/Cellar/azure-cli/2.0.75/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 485, in default_command_handler
return op(
command_args)
File "/usr/local/Cellar/azure-cli/2.0.75/libexec/lib/python3.7/site-packages/azure/cli/command_modules/acs/custom.py", line 1844, in aks_enable_addons
_ensure_container_insights_for_monitoring(cmd, instance.addon_profiles['omsagent'])
File "/usr/local/Cellar/azure-cli/2.0.75/libexec/lib/python3.7/site-packages/azure/cli/command_modules/acs/custom.py", line 2426, in _ensure_container_insights_for_monitoring
if 'loganalyticsworkspaceresourceid' in addon.config:
TypeError: argument of type 'NoneType' is not iterable

To open an issue, please run: 'az feedback'
command ran in 0.986 seconds.

It looks like addon.config didn't get initialized before it's referenced here. @ganga1980 have you seen this CLI bug?

This is being addressed in this PR: https://github.com/Azure/azure-cli/pull/12250 cc @junsun17

The proposed fix has been merged into the AKS-preview extension and core build for the S166 sprint. The core release is set for 3/10.

https://github.com/Azure/azure-cli/milestone/83

Can confirm the latest CLI resolved this issue for me.

$ az --version
azure-cli                          2.2.0

command-modules-nspkg              2.0.3
core                               2.2.0
nspkg                              3.0.4
telemetry                          1.0.4

Thanks for the confirm @seanhamlin! I am also unable to reproduce this issue, so closing as a result. However if you still encounter this issue please comment here and we will revisit.

Appreciate everyone's feedback as we drive these fixes.

Was this page helpful?
0 / 5 - 0 ratings