Skip to content

Commit

Permalink
WIP: exception title, kind off
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaso committed Mar 31, 2024
1 parent 353d702 commit 0661c6b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions vault_oidc_ssh_cert_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ def _issue_vault_token(
response = requests.post(login_url, data=payload, timeout=10)
response.raise_for_status()
except requests.exceptions.RequestException as request_error:
title = "Vault login error"
message = f"{type(request_error).__name__}: {str(request_error)}"
_set_error_message("Vault login error", message)
raise VoscaError from request_error
_set_error_message(title, message)
raise VoscaError(title) from request_error

vault_token: str = response.json()["auth"]["client_token"]
return vault_token
Expand All @@ -64,9 +65,10 @@ def _issue_ssh_cert(
response = requests.post(issue_url, headers=headers, data=payload, timeout=10)
response.raise_for_status()
except requests.exceptions.RequestException as request_error:
title = "Vault SSH certificate signing error"
message = f"{type(request_error).__name__}: {str(request_error)}"
_set_error_message("Vault SSH certificate signing error", message)
raise VoscaError from request_error
_set_error_message(title, message)
raise VoscaError(title) from request_error

ssh_cert: str = response.json()["data"]["signed_key"]
return ssh_cert
Expand Down

0 comments on commit 0661c6b

Please sign in to comment.