Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3.01k forks source link

CI intermittently fails with 'xxx' is misspelled or not recognized by the system #28643

Open jiasli opened 8 months ago

jiasli commented 8 months ago

CI intermittently fails with 'xxx' is misspelled or not recognized by the system.

monitor log-analytics workspace show:

https://dev.azure.com/azclitools/public/_build/results?buildId=143891&view=logs&j=7fb4765b-0b16-5931-a619-9525bfc06049&t=34041a79-d541-52ce-7de5-4b24f268698c

>       workspace_id = self.cmd('monitor log-analytics workspace show -n {workspace1} -g {rg}').get_output_in_json()['id']

/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:2363: 

ERROR    cli.azure.cli.core.azclierror:azlogging.py:212 'show' is misspelled or not recognized by the system.

=========================== short test summary info ============================
FAILED tests/latest/test_vm_commands.py::VMMonitorTestUpdateLinux::test_vm_update_with_workspace_linux

https://github.com/Azure/azure-cli/blob/96828277d73a8ae4e407e6aef66aeff328798c52/src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/workspace/_show.py#L14-L16

vm generalize:

https://dev.azure.com/azclitools/public/_build/results?buildId=141855&view=logs&j=788bfeb8-6c0f-5544-4e87-f6639738ee28&t=9eb1d89a-c9da-5ad8-571d-2d09b1c8859f

>       self.cmd('vm generalize -g {rg} -n {vm1}')

/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:524: 

ERROR    cli.azure.cli.core.azclierror:azlogging.py:212 'generalize' is misspelled or not recognized by the system.

=========================== short test summary info ============================
FAILED tests/latest/test_vm_commands.py::VMCustomImageTest::test_vm_custom_image_debian

https://github.com/Azure/azure-cli/blob/95af8f816501242a7b174228cec125a207d5d531/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_generalize.py#L14-L16

yonzhan commented 8 months ago

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

jiasli commented 8 months ago

Some more occurrences:

https://dev.azure.com/azclitools/public/_build/results?buildId=143891&view=logs&j=7fb4765b-0b16-5931-a619-9525bfc06049&t=34041a79-d541-52ce-7de5-4b24f268698c&l=8975

>       workspace_id = self.cmd('monitor log-analytics workspace show -n {workspace1} -g {rg}').get_output_in_json()['id']

/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:2363: 

ERROR    cli.azure.cli.core.azclierror:azlogging.py:212 'show' is misspelled or not recognized by the system.

https://dev.azure.com/azclitools/public/_build/results?buildId=144398&view=logs&j=038813f6-b85b-5e37-acf4-30b28352865f&t=48a22e66-ceab-5c7f-d00b-cb2046709dfd

>       self.cmd('network nsg show --resource-group {rg} --name {nsg}', checks=[
            self.check('tags.firsttag', '1'),
            self.check('tags.secondtag', '2'),
            self.check('tags.thirdtag', ''),
        ])

/opt/az/lib/python3.11/site-packages/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:1431: 

ERROR    cli.azure.cli.core.azclierror:azlogging.py:212 'show' is misspelled or not recognized by the system.

https://github.com/Azure/azure-cli/blob/9e1b1b907497d009561d14d208f37ab32389741f/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/nsg/_show.py#L14-L16

AllyW commented 8 months ago

it seems only happening in debian system for vm test. The cmd failed is:

/opt/az/bin/python3 -m pytest -v --forked -p no:warnings --log-level=WARN -n auto --junit-xml /azure_cli_test_result/vm.xml --pyargs azure.cli.command_modules.vm

AllyW commented 8 months ago

Put vm module into serial testing mod should avoid it.

jiasli commented 8 months ago

it seems only happening in debian system for vm test.

Aren't az monitor log-analytics workspace show and az network nsg show also affected?

I think it's better to get to the bottom to understand why the error happens.

kairu-ms commented 8 months ago

@AllyW, the aaz commands support partially loading in command table for performance. It use environ variable AZURE_AAZ_FULL_LOAD to control. Here's the related code for your reference. Maybe you can start from that. https://github.com/Azure/azure-cli/blob/e4018b7bcacf82d6b96587e8e0364769ad150681/src/azure-cli-core/azure/cli/core/aaz/_command.py#L382-L406 BTW, I'm not recommend open the AZURE_AAZ_FULL_LOAD in tests playback.

alevol00 commented 6 months ago

Hi,

I have a similar error

intermittently I have the following error.

ERROR: 'devops' is misspelled or not recognized by the system.

Examples from the artificial intelligence knowledge base:
az extension add --name anextension
Adds an extension by name

az extension list-available
Lists all publicly available extensions 

https://docs.microsoft.com/en-US/cli/azure/extension#az_extension_add
More information about the command in the reference documents
Updating Permissions
CAUTION: The command requires the azure-devops extension. It will be installed first.

Before running any powershell scripts with az commands the following command is present.

az config set extension.use_dynamic_install=yes_without_prompt

i get the error using self hosted agents on azure devops with ubuntu OS Are there any updates to fix the problem?