Azure / azure-cli

Azure Command-Line Interface
MIT License
3.99k stars 2.97k forks source link

az sql db list-editions --available throws "'NoneType' object is not iterable" #9411

Closed simonbrady closed 5 years ago

simonbrady commented 5 years ago

Describe the bug

Running az sql db list-editions --available for a location with available SQL DB editions consistently throws the below error. Running the command without the --available flag, or with the flag but in a location where no DB editions are available, works fine.

Command Name az sql db list-editions

Errors:

'NoneType' object is not iterable
Traceback (most recent call last):
python3.6/site-packages/knack/cli.py, ln 206, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 560, in execute
    raise ex
cli/core/commands/__init__.py, ln 618, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
cli/core/commands/__init__.py, ln 611, in _run_job
    six.reraise(*sys.exc_info())
lib/python3.6/site-packages/six.py, ln 693, in reraise
    raise value
...
azure/cli/core/__init__.py, ln 453, in default_command_handler
    return op(**command_args)
cli/command_modules/sql/custom.py, ln 881, in db_list_capabilities
    slo.supported_max_sizes = _filter_available(slo.supported_max_sizes)
cli/command_modules/sql/custom.py, ln 134, in _filter_available
    return [c for c in capabilities if is_available(c.status)]
TypeError: 'NoneType' object is not iterable

To Reproduce:

The choice of location will vary by subscription: in my case, the command fails for australiaeast, eastus, westus but works (and correctly returns an empty list) for australiasoutheast because no DB editions are available to me there.

Expected Behavior

Command shoud list all the SQL DB editions available in the chosen location.

Environment Summary

Linux-4.4.0-17763-Microsoft-x86_64-with-debian-buster-sid
Python 3.6.5
Shell: bash

azure-cli 2.0.64

Additional Context

yugangw-msft commented 5 years ago

@jaredmoo, any ideas?

jaredmoo commented 5 years ago

The issue is that Hyperscale service objectives have null supportedMaxSizes. This is by design, since Hyperscale has unlimited size. However the CLI command isn't handling this correctly. Thank you for reporting this issue!