Skip to content

KeyVault non 404/409 exceptions raises generated exceptions #9690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lmazuel opened this issue Feb 3, 2020 · 0 comments · Fixed by #9716
Closed

KeyVault non 404/409 exceptions raises generated exceptions #9690

lmazuel opened this issue Feb 3, 2020 · 0 comments · Fixed by #9716
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. KeyVault

Comments

@lmazuel
Copy link
Member

lmazuel commented Feb 3, 2020

All KeyVault are using "map_error" on 404/409, meaning everything else will raise a generated exception. Example with 403:

Traceback (most recent call last):
  File ".\hello_world.py", line 46, in <module>
    secret = client.set_secret("helloWorldSecretName", "helloWorldSecretValue", expires_on=expires)
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\core\azure-core\azure\core\tracing\decorator.py", line 71, in wrapper_use_tracer
    return func(*args, **kwargs)
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\keyvault\azure-keyvault-secrets\azure\keyvault\secrets\_client.py", line 112, in set_secret
    vault_base_url=self.vault_url, secret_name=name, value=value, secret_attributes=attributes, **kwargs
  File "c:\users\lmazuel\git\azure-sdk-for-python\sdk\keyvault\azure-keyvault-secrets\azure\keyvault\secrets\_shared\_generated\v7_0\operations\_key_vault_client_operations.py", line 1435, in set_secret
    raise models.KeyVaultErrorException(response, self._deserialize)
azure.keyvault.secrets._shared._generated.v7_0.models._models_py3.KeyVaultErrorException: (Forbidden) Access denied. Caller was not found on any access policy.

We should not under any circumstances raise anything from generated. We shall add a fallback to catch unexpected stuff.
While using "map_error", @johanste suggested to use a default dict for this kind of scenario
https://docs.python.org/2/library/collections.html#collections.defaultdict

@lmazuel lmazuel added KeyVault Client This issue points to a problem in the data-plane of the library. labels Feb 3, 2020
@chlowell chlowell self-assigned this Feb 3, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. KeyVault
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants