Azure / Azure/azure-cli-extensions

Fail to load all the helps by python code when 'arcdata' installed

Open
#4,800 9 comments 0 reactions 0 assignees View on GitHub
arcdata feature-request needs-team-attention Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

### Related command
not sure

### Extension name (the extension in question)
arcdata

### Description of issue (in as much detail as possible)
When I try to get all the helps by python code when 'arcdata' installed. There is exception. Check my scripts:
```
pip install azure-cli
az extension add -n arcdata
```
and python code:
```
from azure.cli.core import MainCommandsLoader, AzCli
from azure.cli.core.commands import AzCliCommandInvoker, ExtensionCommandSource
from azure.cli.core.parser import AzCliCommandParser
from azure.cli.core.file_util import create_invoker_and_load_cmds_and_args, get_all_help
from azure.cli.core._help import AzCliHelp, CliCommandHelpFile
from unittest.mock import patch

az_cli = AzCli(cli_name='az',
commands_loader_cls=MainCommandsLoader,
invocation_cls=AzCliCommandInvoker,
parser_cls=AzCliCommandParser,
help_cls=AzCliHelp)

with patch('getpass.getuser', return_value='your_system_user_login_name'):
create_invoker_and_load_cmds_and_args(az_cli)

help_files = get_all_help(az_cli)
```
exception is:
```
Exception has occurred: ModuleNotFoundError
No module named 'kubernetes.client.exceptions'
File "C:\Users\shujia\.azure\cliextensions\arcdata\azext_arcdata\core\kubernetes.py", line 21, in
from kubernetes.client.exceptions import ApiException
File "C:\Users\shujia\.azure\cliextensions\arcdata\azext_arcdata\sqlmi\custom.py", line 16, in
import azext_arcdata.core.kubernetes as kubernetes_util
File "C:\_repos\ReferenceAutomation\AzureCli\ExportCommands.py", line 83, in
create_invoker_and_load_cmds_and_args(az_cli)
```

### Additional context
I am using this information to generate the Docs Page(https://docs.microsoft.com/en-us/cli/azure/arcdata?view=azure-cli-latest) . This exception could break our pipeline.
To workaround this. Currently I install another package 'kubernetes' then the exception disappear.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.