Azure / azure-cli

Azure Command-Line Interface
MIT License
4.02k stars 2.99k forks source link

az sf cluster client-certificate add command is broken #18358

Open Sheshagiri opened 3 years ago

Sheshagiri commented 3 years ago

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug az sf cluster client-certificate add is not working as expected.

Error:

sheshagiri@Azure:~$ az sf cluster client-certificate add -g sf-cluster -c sf-cluster --certificate-common-name sf-cluster-2.com --certificate-issuer-thumbprint C5D92ACFB28216C3FAD2315644712F4AF20D3AEF
The command failed with an unexpected error. Here is the traceback:
local variable 'remove' referenced before assignment
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
    raise ex
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/servicefabric/custom.py", line 369, in add_client_cert
    certificate_issuer_thumbprint)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/servicefabric/custom.py", line 352, in _add_common_name
    if remove:
UnboundLocalError: local variable 'remove' referenced before assignment
To open an issue, please run: 'az feedback'
sheshagiri@Azure:~$

To Reproduce Try adding a new issuer thumbprint to the service fabric cluster using azure cli, Following is an example.

az sf cluster client-certificate add -g <sf-cluster-rg> -c <sf-cluster> --certificate-common-name <cert-common-name> --certificate-issuer-thumbprint <cert-thumbprint>

Expected behavior The command should not they any error and new thumbprint should be added to service fabric cluster.

Environment summary

{
  "azure-cli": "2.24.0",
  "azure-cli-core": "2.24.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {
    "ai-examples": "0.2.5",
    "ssh": "0.1.5"
  }
}

Additional context N/A

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @QingChenmsft, @vaishnavk, @juhacket.

Issue Details
> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62 **Describe the bug** az sf cluster client-certificate add is not working as expected. Error: ```log sheshagiri@Azure:~$ az sf cluster client-certificate add -g sf-cluster -c sf-cluster --certificate-common-name sf-cluster-2.com --certificate-issuer-thumbprint C5D92ACFB28216C3FAD2315644712F4AF20D3AEF The command failed with an unexpected error. Here is the traceback: local variable 'remove' referenced before assignment Traceback (most recent call last): File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke cmd_result = self.invocation.execute(args) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute raise ex File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job result = cmd_copy(params) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__ return self.handler(*args, **kwargs) File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler return op(**command_args) File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/servicefabric/custom.py", line 369, in add_client_cert certificate_issuer_thumbprint) File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/servicefabric/custom.py", line 352, in _add_common_name if remove: UnboundLocalError: local variable 'remove' referenced before assignment To open an issue, please run: 'az feedback' sheshagiri@Azure:~$ ``` **To Reproduce** Try adding a new issuer thumbprint to the service fabric cluster using azure cli, Following is an example. ```bash az sf cluster client-certificate add -g -c --certificate-common-name --certificate-issuer-thumbprint ``` **Expected behavior** The command should not they any error and new thumbprint should be added to service fabric cluster. **Environment summary** ```json { "azure-cli": "2.24.0", "azure-cli-core": "2.24.0", "azure-cli-telemetry": "1.0.6", "extensions": { "ai-examples": "0.2.5", "ssh": "0.1.5" } } ``` **Additional context** N/A
Author: Sheshagiri
Assignees: -
Labels: `Service Attention`, `Service Fabric`
Milestone: -
yonzhan commented 3 years ago

route to service team

mwesigwaguma commented 1 month ago

https://github.com/Azure/azure-cli/pull/29861