Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.
https://docs.microsoft.com/en-us/cli/azure
MIT License
382 stars 1.23k forks source link

`az artifacts universal download` throws error #830

Closed joaomoreno closed 5 years ago

joaomoreno commented 5 years ago

Describe the bug

$ az extension add --name azure-devops
$ az artifacts universal download
No module named 'azure.cli.core.extension.operations'; 'azure.cli.core.extension' is not a package
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 197, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 262, in execute
    self.commands_loader.load_arguments(command)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 253, in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 141, in load_arguments
    super(AzCliCommand, self).load_arguments()
  File "/opt/az/lib/python3.6/site-packages/knack/commands.py", line 76, in load_arguments
    cmd_args = self.arguments_loader()
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 440, in default_arguments_loader
    op = handler or self.get_op_handler(operation)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 485, in get_op_handler
    op = import_module(mod_to_import)
  File "/opt/az/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/joao/.azure/cliextensions/azure-devops/azext_devops/dev/artifacts/universal.py", line 8, in <module>
    from azext_devops.dev.common.services import resolve_instance
  File "/home/joao/.azure/cliextensions/azure-devops/azext_devops/dev/common/services.py", line 30, in <module>
    from ._credentials import get_credential
  File "/home/joao/.azure/cliextensions/azure-devops/azext_devops/dev/common/_credentials.py", line 10, in <module>
    from .credential_store import CredentialStore
  File "/home/joao/.azure/cliextensions/azure-devops/azext_devops/dev/common/credential_store.py", line 12, in <module>
    from .pip_helper import install_keyring
  File "/home/joao/.azure/cliextensions/azure-devops/azext_devops/dev/common/pip_helper.py", line 9, in <module>
    from azure.cli.core.extension.operations import _run_pip
ModuleNotFoundError: No module named 'azure.cli.core.extension.operations'; 'azure.cli.core.extension' is not a package

To Reproduce Just follow the steps above.

Expected behavior Command should not throw.

Environment summary

$ az --version
azure-cli (2.0.49)

acr (2.1.7)
acs (2.3.9)
advisor (0.6.0)
ams (0.2.4)
appservice (0.2.5)
backup (1.2.1)
batch (3.4.1)
batchai (0.4.4)
billing (0.2.0)
botservice (0.1.1)
cdn (0.2.0)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.7)
core (2.0.49)
cosmosdb (0.2.2)
dla (0.2.3)
dls (0.1.4)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.3.0)
extension (0.2.2)
feedback (2.1.4)
find (0.2.12)
hdinsight (0.1.0)
interactive (0.3.31)
iot (0.3.3)
iotcentral (0.1.3)
keyvault (2.2.5)
lab (0.1.2)
maps (0.3.2)
monitor (0.2.5)
network (2.2.7)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.2)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.5)
role (2.1.8)
search (0.1.1)
servicebus (0.3.1)
servicefabric (0.1.6)
signalr (1.0.0)
sql (2.1.5)
storage (2.2.3)
telemetry (1.0.0)
vm (2.2.6)

Extensions:
azure-devops (0.11.0)
webapp (0.2.7)

Python location '/opt/az/bin/python3'
Extensions directory '/home/joao/.azure/cliextensions'

Python (Linux) 3.6.5 (default, Oct 18 2018, 19:51:37) 
[GCC 7.3.0]

Legal docs and information: aka.ms/AzureCliLegal
adewaleo commented 5 years ago

@joaomoreno @atbagga, i think this issue should be in the devops cli extension repo.

atbagga commented 5 years ago

@joaomoreno Thank you for reporting the issue. This is not a generic issue so we will need some more details from your environment. Can you help me with the below, which will help us debug this further..

  1. Are you able to run other Azure Cli commands? Try az account list.
  2. Are you able to run other extensions command? I see you have webapp extension installed so you can try az webapp list
  3. Please share the debug logs for the command run.. if any one of the above command (1) or (2) FAILS then sharing logs from the command run with --debug will be helpful. If the above commands work fine, share the output of the artifacts download command with --debug which is failing for you.

Thanks!

joaomoreno commented 5 years ago

I couldn't repro this on my home box, so I reinstalled it on my work box. Now it works as well there. Closing this.

New (working) version is:

$ az --version
azure-cli                         2.0.68

command-modules-nspkg               2.0.3
core                              2.0.68
nspkg                              3.0.4
telemetry                          1.0.3

Extensions:
azure-devops                      0.11.0

Python location '/opt/az/bin/python3'
Extensions directory '/home/joao/.azure/cliextensions'

Python (Linux) 3.6.5 (default, Jun 28 2019, 06:19:46) 
[GCC 8.3.0]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.