Skip to content

az keyvault: module 'inspect' has no attribute 'getargspec' (Python 3.11) #26398

@nemobis

Description

@nemobis

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az keyvault secret show

Errors:

module 'inspect' has no attribute 'getargspec'

Traceback:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/usr/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 "/usr/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/azure/cli/command_modules/keyvault/_command_type.py", line 138, in keyvault_command_handler
    return keyvault_exception_handler(self.command_loader, ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/azure/cli/command_modules/keyvault/_command_type.py", line 51, in keyvault_exception_handler
    raise CLIError(ex)
knack.util.CLIError: module 'inspect' has no attribute 'getargspec'

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 keyvault secret show --vault-name {} --name {}

Expected Behavior

Not error out

Environment Summary

azure-cli installed from Fedora repositories, both Fedora 37and Fedora 38

Linux-6.2.11-200.fc37.x86_64-x86_64-with-glibc2.36, Fedora Linux 37 (KDE Plasma)
Python 3.11.3
Installer: RPM

azure-cli 2.48.1

Additional Context

inspect.getargspec() was deprecated in Python 3.0 (released in 2008),

python/cpython#100680 (comment)

In master it's supposed to be called only for backward compatibility:

$ ack -C1 getargspec
src/azure-cli-core/azure/cli/core/util.py
664-    except AttributeError:
665:        sig = inspect.getargspec(op)  # pylint: disable=deprecated-method
666-        return sig.args

src/azure-cli-testsdk/azure/cli/testsdk/scenario_tests/utilities.py
72-    if not is_preparer_func(fn):
73:        args, _, kw, _ = inspect.getargspec(fn)  # pylint: disable=deprecated-method
74-        if kw is None:

src/azure-cli/azure/cli/command_modules/keyvault/vendored_sdks/azure_keyvault_t1/key_vault_authentication.py
61-        return self._user_callback(server, resource, scope) \
62:            if len(inspect.getargspec(self._user_callback).args) == 3 \
63-            else self._user_callback(server, resource, scope, scheme)

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamKeyVaultaz keyvaultcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions