Azure / azure-cli

Azure Command-Line Interface
MIT License
3.96k stars 2.94k forks source link

Error in running az ml connection list #28295

Open ZhiliangWu opened 7 months ago

ZhiliangWu commented 7 months ago

Describe the bug

As in https://learn.microsoft.com/en-us/cli/azure/ml/connection?view=azure-cli-latest#az-ml-connection-list, this command shall list all the workspaces' connection. However, it is returning errors.

Related command

az ml connection list

Errors

Met error <class 'UnboundLocalError'>:cannot access local variable 'credentials' where it is not associated with a value
Please check log by running the command with '--debug' for more details.

Issue script & Debug output

Traceback (most recent call last):
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/custom/workspace_connection.py", line 81, in ml_workspace_connection_list
    return list(map(lambda x: _dump_entity_with_warnings(x), results))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/core/paging.py", line 123, in __next__
    return next(self._page_iterator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/core/paging.py", line 83, in __next__
    self.continuation_token, self._current_page = self._extract_data(self._response)
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/_restclient/v2023_06_01_preview/operations/_workspace_connections_operations.py", line 371, in extract_data
    list_of_elem = cls(list_of_elem)
                   ^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/operations/_workspace_connections_operations.py", line 153, in <lambda>
    cls=lambda objs: [WorkspaceConnection._from_rest_object(obj) for obj in objs],
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/operations/_workspace_connections_operations.py", line 153, in <listcomp>
    cls=lambda objs: [WorkspaceConnection._from_rest_object(obj) for obj in objs],
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/entities/_workspace/connections/workspace_connection.py", line 228, in _from_rest_object
    rest_kwargs = cls._extract_kwargs_from_rest_obj(rest_obj=rest_obj, popped_tags=popped_tags)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/entities/_workspace/connections/workspace_connection.py", line 304, in _extract_kwargs_from_rest_obj
    "credentials": credentials,
                   ^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'credentials' where it is not associated with a value
cli: None
cli: Traceback (most recent call last):
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/custom/workspace_connection.py", line 81, in ml_workspace_connection_list
    return list(map(lambda x: _dump_entity_with_warnings(x), results))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/core/paging.py", line 123, in __next__
    return next(self._page_iterator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/core/paging.py", line 83, in __next__
    self.continuation_token, self._current_page = self._extract_data(self._response)
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/_restclient/v2023_06_01_preview/operations/_workspace_connections_operations.py", line 371, in extract_data
    list_of_elem = cls(list_of_elem)
                   ^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/operations/_workspace_connections_operations.py", line 153, in <lambda>
    cls=lambda objs: [WorkspaceConnection._from_rest_object(obj) for obj in objs],
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/operations/_workspace_connections_operations.py", line 153, in <listcomp>
    cls=lambda objs: [WorkspaceConnection._from_rest_object(obj) for obj in objs],
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/entities/_workspace/connections/workspace_connection.py", line 228, in _from_rest_object
    rest_kwargs = cls._extract_kwargs_from_rest_obj(rest_obj=rest_obj, popped_tags=popped_tags)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/entities/_workspace/connections/workspace_connection.py", line 304, in _extract_kwargs_from_rest_obj
    "credentials": credentials,
                   ^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'credentials' where it is not associated with a value

cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/custom/workspace_connection.py", line 81, in ml_workspace_connection_list
    return list(map(lambda x: _dump_entity_with_warnings(x), results))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/core/paging.py", line 123, in __next__
    return next(self._page_iterator)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/core/paging.py", line 83, in __next__
    self.continuation_token, self._current_page = self._extract_data(self._response)
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/_restclient/v2023_06_01_preview/operations/_workspace_connections_operations.py", line 371, in extract_data
    list_of_elem = cls(list_of_elem)
                   ^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/operations/_workspace_connections_operations.py", line 153, in <lambda>
    cls=lambda objs: [WorkspaceConnection._from_rest_object(obj) for obj in objs],
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/operations/_workspace_connections_operations.py", line 153, in <listcomp>
    cls=lambda objs: [WorkspaceConnection._from_rest_object(obj) for obj in objs],
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/entities/_workspace/connections/workspace_connection.py", line 228, in _from_rest_object
    rest_kwargs = cls._extract_kwargs_from_rest_obj(rest_obj=rest_obj, popped_tags=popped_tags)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/vendored_curated_sdk/azure/ai/ml/entities/_workspace/connections/workspace_connection.py", line 304, in _extract_kwargs_from_rest_obj
    "credentials": credentials,
                   ^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'credentials' where it is not associated with a value

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/custom/workspace_connection.py", line 83, in ml_workspace_connection_list
    log_and_raise_error(err, debug)
  File "/Users/********/.azure/cliextensions/ml/azext_mlv2/manual/custom/raise_error.py", line 181, in log_and_raise_error
    raise cli_error
knack.util.CLIError: Met error <class 'UnboundLocalError'>:cannot access local variable 'credentials' where it is not associated with a value
Please check log by running the command with '--debug' for more details.

cli.azure.cli.core.azclierror: Met error <class 'UnboundLocalError'>:cannot access local variable 'credentials' where it is not associated with a value
Please check log by running the command with '--debug' for more details.
az_command_data_logger: Met error <class 'UnboundLocalError'>:cannot access local variable 'credentials' where it is not associated with a value
Please check log by running the command with '--debug' for more details.
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x1068762a0>]

Expected behavior

list all the workspaces' connection

Environment Summary

az --version
azure-cli 2.56.0

core 2.56.0 telemetry 1.1.0

Extensions: ml 2.22.0

Dependencies: msal 1.24.0b2 azure-mgmt-resource 23.1.0b2

Additional context

No response

yonzhan commented 7 months ago

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

microsoft-github-policy-service[bot] commented 7 months ago

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