Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

az throws "unexpected error" when the ssh extension is not installed - should be expected error #22866

Open sflobbe opened 2 years ago

sflobbe commented 2 years ago

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az network bastion ssh

Errors:

The command failed with an unexpected error. Here is the traceback:
The extension ssh is not installed.
Traceback (most recent call last):
  File "/usr/lib64/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/network/custom.py", line 8375, in ssh_bastion_host
    _test_extension(SSH_EXTENSION_NAME)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/network/custom.py", line 8303, in _test_extension
    ext = get_extension(extension_name)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/extension/__init__.py", line 340, in get_extension
    raise ExtensionNotInstalledException(ext_name)
azure.cli.core.extension.ExtensionNotInstalledException: The extension ssh is not installed.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

  1. show me how the ssh extension can be installed
  2. do not throw an "unexpected error"

Environment Summary

Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-centos-7.9.2009-Core, CentOS Linux 7 (Core)
Python 3.6.8
Installer: RPM

azure-cli 2.37.0

Extensions:
storage-preview 0.8.0

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

yonzhan commented 2 years ago

route to CXP team

SatishBoddu-MSFT commented 2 years ago

Hello @sflobbe Could you please confirm if this issue is still persisting? we would like to hear more from the issue you are facing.

ghost commented 2 years ago

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

sflobbe commented 2 years ago

I'm on the latest official release for my platform (azure-cli-2.37.0-1.el7.x86_64) which has not changed, so the output is still the same (as is to be expected). To reproduce:

$ az extension remove -n ssh $ az network bastion ssh --username xxx --auth-type ssh-key --ssh-key ~/.ssh/id_rsa --resource-group bastion-rg --name bastion --target-resource-id "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Compute/virtualMachines/xxx-vm"

This gives a lot of output (namely, a python stack trace) and this message: "The command failed with an unexpected error."

The expected behaviour would be:

  1. show me how the ssh extension can be installed
  2. do not throw an "unexpected error"

This also has not changed. BTW I never said I was "facing the issue" I just wanted to provide you with feedback to improve the user experience. All I have to do is install the ssh-extension, and I can work with "az network bastion ssh ..".

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aznetsuppgithub.

Issue Details
### **This is autogenerated. Please review and update as needed.** ## Describe the bug **Command Name** `az network bastion ssh` **Errors:** ``` The command failed with an unexpected error. Here is the traceback: The extension ssh is not installed. Traceback (most recent call last): File "/usr/lib64/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke cmd_result = self.invocation.execute(args) File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute raise ex File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job result = cmd_copy(params) File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__ return self.handler(*args, **kwargs) File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/network/custom.py", line 8375, in ssh_bastion_host _test_extension(SSH_EXTENSION_NAME) File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/network/custom.py", line 8303, in _test_extension ext = get_extension(extension_name) File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/extension/__init__.py", line 340, in get_extension raise ExtensionNotInstalledException(ext_name) azure.cli.core.extension.ExtensionNotInstalledException: The extension ssh is not installed. ``` ## To Reproduce: Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information. - _Put any pre-requisite steps here..._ - `az network bastion ssh --name {} --resource-group {} --target-resource-id {} --auth-type {} --username {}` ## Expected Behavior 1. show me how the ssh extension can be installed 2. do not throw an "unexpected error" ## Environment Summary ``` Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-centos-7.9.2009-Core, CentOS Linux 7 (Core) Python 3.6.8 Installer: RPM azure-cli 2.37.0 Extensions: storage-preview 0.8.0 Dependencies: msal 1.18.0b1 azure-mgmt-resource 21.1.0b1 ``` ## Additional Context
Author: sflobbe
Assignees: -
Labels: `Network`, `Service Attention`, `Feedback`, `customer-reported`, `needs-team-attention`, `Network - Bastion`, `Auto-Assign`
Milestone: Backlog
quintindk commented 2 years ago

Any feedback on this? Same issue in WSL.

slyons commented 1 year ago

Encountered this and made progress by running az extension add --name ssh