Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az network vnet list --output table #27066

Closed
OlehAhieienko opened this issue Aug 2, 2023 · 2 comments · Fixed by #27076
Closed

az network vnet list --output table #27066

OlehAhieienko opened this issue Aug 2, 2023 · 2 comments · Fixed by #27076
Assignees
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Network az network vnet/lb/nic/dns/etc... Possible-Solution Similar-Issue
Milestone

Comments

@OlehAhieienko
Copy link

Describe the bug

az network vnet list --output table returns error
Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info., while table is present in list of formats (az network vnet list --help):

    --output -o         : Output format.  Allowed values: json, jsonc, none, table, tsv, yaml,
                          yamlc.  Default: json.

Related command

az network vnet list

Errors

Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.

Issue script & Debug output

(azure-cli-venv) [user@work ansible]$ az network vnet list --output table --debug
cli.knack.cli: Command arguments: ['network', 'vnet', 'list', '--output', 'table', '--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 0x7fe402080360>, <function OutputProducer.on_global_arguments at 0x7fe402036ac0>, <function CLIQuery.on_global_arguments at 0x7fe401e585e0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'network': ['azure.cli.command_modules.network', 'azure.cli.command_modules.privatedns']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: network 0.213 114 357
cli.azure.cli.core: privatedns 0.003 14 63
cli.azure.cli.core: Total (2) 0.216 128 420
cli.azure.cli.core: Loaded 127 groups, 420 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : network vnet list
cli.azure.cli.core: Command table: network vnet list
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fe40098d940>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/user/.azure/commands/2023-08-02.13-46-44.network_vnet_list.15238.log'.
az_command_data_logger: command args: network vnet list --output {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7fe4009d7f60>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7fe4009f6160>, <function register_cache_arguments..add_cache_arguments at 0x7fe4009f62a0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fe402036b60>, <function CLIQuery.handle_query_parameter at 0x7fe401e58680>, <function register_ids_argument..parse_ids_arguments at 0x7fe4009f6200>]
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/user/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/user/.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 = {...}
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: ...
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/...'
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': '...'
cli.azure.cli.core.sdk.policies: 'CommandName': 'network vnet list'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--output --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.51.0 (PIP) (AAZ) azsdk-python-core/1.28.0 Python/3.11.3 (Linux-6.4.7-arch1-2-x86_64-with-glibc2.37)'
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/... 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': '...'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '...'
cli.azure.cli.core.sdk.policies: 'x-ms-arm-service-request-id': '...'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'Server': 'Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '11999'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': '...'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'Date': 'Wed, 02 Aug 2023 10:46:44 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {<JSON_DATA>}
cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x7fe4009d71a0>, <function _x509_from_base64_to_hex_transform at 0x7fe4009d7240>]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
cli.knack.output: Traceback (most recent call last):
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/knack/output.py", line 72, in format_table
result = obj.table_transformer(result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/azure/cli/command_modules/network/_format.py", line 98, in transform_vnet_table_output
return [_transform(r) for r in result]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/azure/cli/command_modules/network/_format.py", line 98, in
return [_transform(r) for r in result]
^^^^^^^^^^^^^
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/azure/cli/command_modules/network/_format.py", line 95, in _transform
item['VMProtection'] = result['enableVmProtection']
~~~~~~^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'enableVmProtection'

cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/knack/output.py", line 72, in format_table
result = obj.table_transformer(result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/azure/cli/command_modules/network/_format.py", line 98, in transform_vnet_table_output
return [_transform(r) for r in result]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/azure/cli/command_modules/network/_format.py", line 98, in
return [_transform(r) for r in result]
^^^^^^^^^^^^^
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/azure/cli/command_modules/network/_format.py", line 95, in _transform
item['VMProtection'] = result['enableVmProtection']
~~~~~~^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'enableVmProtection'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/knack/cli.py", line 239, in invoke
self.output.out(cmd_result, formatter=formatter, out_file=out_file)
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/knack/output.py", line 146, in out
output = formatter(obj)
^^^^^^^^^^^^^^
File "/home/user/azure-cli-venv/lib/python3.11/site-packages/knack/output.py", line 79, in format_table
raise CLIError("Table output unavailable. "
knack.util.CLIError: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.

cli.azure.cli.core.azclierror: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.
az_command_data_logger: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info.
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fe40098dbc0>]
az_command_data_logger: exit code: 1
cli.main: Command ran in 0.613 seconds (init: 0.113, invoke: 0.500)
(azure-cli-venv) [user@work ansible]$

Expected behavior

Print vnets as a table

Environment Summary

azure-cli 2.51.0

core 2.51.0
telemetry 1.1.0

Dependencies:
msal 1.24.0b1
azure-mgmt-resource 23.1.0b2

Python location '/home/user/azure-cli-venv/bin/python'
Extensions directory '/home/user/.azure/cliextensions'

Python (Linux) 3.11.3 (main, Jun 5 2023, 09:32:32) [GCC 13.1.1 20230429]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

@OlehAhieienko OlehAhieienko added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Aug 2, 2023
@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. Network az network vnet/lb/nic/dns/etc... labels Aug 2, 2023
@ghost ghost added this to the Backlog milestone Aug 2, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Aug 2, 2023

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

@ghost ghost assigned necusjz Aug 2, 2023
@ghost ghost added the Auto-Assign Auto assign by bot label Aug 2, 2023
@azure-client-tools-bot-prd
Copy link

Hi @OlehAhieienko
Find similar issue #20348.

Issue title tabulate failure: ImportError: cannot import name 'Iterable' from 'collections'
Create time 2021-11-16
Comment number 8

Possible solution:
As mentioned in that issue, the Table output unavailable error has been fixed in Azure CLI 2.31.0. Please update Azure CLI to the latest version 2.31.0 by running brew update && brew upgrade azure-cli. If you still face the issue after updating, you may try the workaround mentioned in the existing issue by installing Python 3.9.9 first and then installing Azure CLI with pip.


Please confirm if this resolves your issue.

@microsoft-github-policy-service microsoft-github-policy-service bot added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 2, 2023
@yonzhan yonzhan removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Aug 2, 2023
necusjz added a commit that referenced this issue Aug 3, 2023
…used (#27076)

* fix output table

* add test case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Network az network vnet/lb/nic/dns/etc... Possible-Solution Similar-Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants