Azure / azure-cli

Azure Command-Line Interface
MIT License
3.93k stars 2.9k forks source link

listing GeoRecovery pairings for event hub yields an error instead of the pairing list #26936

Open Juliavol opened 1 year ago

Juliavol commented 1 year ago

Describe the bug

I am working on az-cli version 2.48.1, trying to list all the georecovery pairings my namespaces have, and getting a 'NoneType' object is not iterable error.

Related command

az eventhubs georecovery-alias list --resource-group --namespace-name

Errors

➜  ~ az eventhubs georecovery-alias list --resource-group <resource-group-name> --namespace-name <namespace-name>
The command failed with an unexpected error. Here is the traceback:
'NoneType' object is not iterable
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 710, in _run_job
    result = list(result)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/core/paging.py", line 128, in __next__
    return next(self._page_iterator)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/core/paging.py", line 84, in __next__
    self.continuation_token, self._current_page = self._extract_data(self._response)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/mgmt/eventhub/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py", line 796, in extract_data
    return deserialized.next_link or None, iter(list_of_elem)
TypeError: 'NoneType' object is not iterable

Issue script & Debug output

az eventhubs georecovery-alias list --resource-group <resource-group-name> --namespace-name <namespace-name>

cli.knack.cli: Command arguments: ['eventhubs', 'georecovery-alias', 'list', '-g', 'prod', '--namespace-name', 'namespace-name', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x10190de10>, <function OutputProducer.on_global_arguments at 0x10199ab90>, <function CLIQuery.on_global_arguments at 0x101a14040>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'eventhubs': ['azure.cli.command_modules.eventhubs']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: eventhubs                 0.028        15        41
cli.azure.cli.core: Total (1)                 0.028        15        41
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: Total (0)                 0.000         0         0
cli.azure.cli.core: Loaded 15 groups, 41 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : eventhubs georecovery-alias list
cli.azure.cli.core: Command table: eventhubs georecovery-alias list
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x102425d80>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/julia.s/.azure/commands/2023-07-19.13-46-18.eventhubs_georecovery-alias_list.78824.log'.
az_command_data_logger: command args: eventhubs georecovery-alias list -g {} --namespace-name {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x102432710>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x10247c430>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x10247c550>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x10199ac20>, <function CLIQuery.handle_query_parameter at 0x101a140d0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x10247c4c0>]
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=EventHubManagementClient
cli.azure.cli.core.auth.persistence: build_persistence: location='/Users/julia.s/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /Users/julia.s/.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/b4c17ed1-faef-4e81-921f-7f337dc07424/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/b4c17ed1-faef-4e81-921f-7f337dc07424/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/b4c17ed1-faef-4e81-921f-7f337dc07424/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/b4c17ed1-faef-4e81-921f-7f337dc07424/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/b4c17ed1-faef-4e81-921f-7f337dc07424/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/b4c17ed1-faef-4e81-921f-7f337dc07424/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/b4c17ed1-faef-4e81-921f-7f337dc07424/kerberos', 'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? False
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: 3ff88118-decb-4f28-9a6d-4bb69bf5b740
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/4fcaccb3-d5eb-47a2-a60b-7c90b7470960/resourceGroups/prod/providers/Microsoft.EventHub/namespaces/namespace-name/disasterRecoveryConfigs?api-version=2022-01-01-preview'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '7e09e718-2621-11ee-9901-c28a837f5175'
cli.azure.cli.core.sdk.policies:     'CommandName': 'eventhubs georecovery-alias list'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '-g --namespace-name --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.48.1 (HOMEBREW) azsdk-python-azure-mgmt-eventhub/10.1.0 Python/3.10.11 (macOS-13.4.1-arm64-arm-64bit)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/4fcaccb3-d5eb-47a2-a60b-7c90b7470960/resourceGroups/prod/providers/Microsoft.EventHub/namespaces/namespace-name/disasterRecoveryConfigs?api-version=2022-01-01-preview HTTP/1.1" 200 None
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Transfer-Encoding': 'chunked'
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies:     'Content-Encoding': 'gzip'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'
cli.azure.cli.core.sdk.policies:     'Vary': 'Accept-Encoding'
cli.azure.cli.core.sdk.policies:     'x-ms-request-id': '3cc1fef4-d1fb-402c-bb70-b3a14755789b_M11CH3_M11CH3'
cli.azure.cli.core.sdk.policies:     'Server-SB': 'Service-Bus-Resource-Provider/CH3'
cli.azure.cli.core.sdk.policies:     'Server': 'Service-Bus-Resource-Provider/CH3, Microsoft-HTTPAPI/2.0'
cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-reads': '11997'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': '7e28f614-d5b4-44f9-ad4d-6b489be2d33a'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'FRANCESOUTH:20230719T104620Z:7e28f614-d5b4-44f9-ad4d-6b489be2d33a'
cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies:     'Date': 'Wed, 19 Jul 2023 10:46:19 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {}
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 710, in _run_job
    result = list(result)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/core/paging.py", line 128, in __next__
    return next(self._page_iterator)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/core/paging.py", line 84, in __next__
    self.continuation_token, self._current_page = self._extract_data(self._response)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/mgmt/eventhub/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py", line 796, in extract_data
    return deserialized.next_link or None, iter(list_of_elem)
TypeError: 'NoneType' object is not iterable

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 710, in _run_job
    result = list(result)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/core/paging.py", line 128, in __next__
    return next(self._page_iterator)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/core/paging.py", line 84, in __next__
    self.continuation_token, self._current_page = self._extract_data(self._response)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/mgmt/eventhub/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py", line 796, in extract_data
    return deserialized.next_link or None, iter(list_of_elem)
TypeError: 'NoneType' object is not iterable
az_command_data_logger: 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 710, in _run_job
    result = list(result)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/core/paging.py", line 128, in __next__
    return next(self._page_iterator)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/core/paging.py", line 84, in __next__
    self.continuation_token, self._current_page = self._extract_data(self._response)
  File "/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/lib/python3.10/site-packages/azure/mgmt/eventhub/v2022_01_01_preview/operations/_disaster_recovery_configs_operations.py", line 796, in extract_data
    return deserialized.next_link or None, iter(list_of_elem)
TypeError: 'NoneType' object is not iterable

Expected behavior

provide me with a list of pairings and their metadata

Environment Summary

azure-cli 2.48.1 *

core 2.48.1 * telemetry 1.0.8

Extensions: storage-preview 0.8.4

Dependencies: msal 1.20.0 azure-mgmt-resource 22.0.0

Python location '/opt/homebrew/Cellar/azure-cli/2.48.1/libexec/bin/python' Extensions directory '/Users/julia.s/.azure/cliextensions'

Python (Darwin) 3.10.11 (main, Apr 7 2023, 07:24:53) [Clang 14.0.0 (clang-1400.0.29.202)]

Additional context

No response

azure-client-tools-bot-prd[bot] commented 1 year ago

Hi @Juliavol,

2.48.1 is not the latest Azure CLI(2.50.0).

Please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

Juliavol commented 1 year ago

This also unavailable in the UI

SaurabhSharma-MSFT commented 1 year ago

@Juliavol I have checked with the latest version (2.50.0) and I am not seeing any issues. Can you please update your az version using az upgrade and try again.

Juliavol commented 1 year ago

@SaurabhSharma-MSFT updated to 2.50.0:

azure-cli                         2.50.0

core                              2.50.0
telemetry                          1.0.8

Extensions:
storage-preview                    0.8.4

Dependencies:
msal                              1.22.0
azure-mgmt-resource             23.1.0b2

Python location '/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/bin/python'
Extensions directory '/Users/julia.s/.azure/cliextensions'

Python (Darwin) 3.10.12 (main, Jun 20 2023, 19:43:52) [Clang 14.0.3 (clang-1403.0.22.14.1)]

Legal docs and information: aka.ms/AzureCliLegal

Sorry, still the same:

The command failed with an unexpected error. Here is the traceback:
'_AAZUndefinedType' object is not iterable
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 710, in _run_job
    result = list(result)
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/aaz/_paging.py", line 49, in __next__
    return next(self._page_iterator)
  File "/opt/homebrew/Cellar/azure-cli/2.50.0/libexec/lib/python3.10/site-packages/azure/cli/core/aaz/_paging.py", line 29, in __next__
    return iter(result)
TypeError: '_AAZUndefinedType' object is not iterable
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Keep in mind that I am running on mac and AZ was installed with homebrew.

SaurabhSharma-MSFT commented 11 months ago

@Juliavol Ok. got it. I am redirecting this to service team to further investigate. Thanks.

schaudhari6254888 commented 4 months ago

Hey @Juliavol , this bug is fixed now you can try the command. if the list is empty it will throw the empty array instead of above error image