diff --git a/vault_oidc_ssh_cert_action.py b/vault_oidc_ssh_cert_action.py index 346ce8e..b919fee 100644 --- a/vault_oidc_ssh_cert_action.py +++ b/vault_oidc_ssh_cert_action.py @@ -60,8 +60,13 @@ def _issue_ssh_cert( headers = {"X-Vault-Token": vault_token} payload = {"public_key": pubkey} - response = requests.post(issue_url, headers=headers, data=payload, timeout=10) - response.raise_for_status() + try: + response = requests.post(issue_url, headers=headers, data=payload, timeout=10) + response.raise_for_status() + except requests.exceptions.RequestException as request_error: + message = f"{type(request_error).__name__}: {str(request_error)}" + _set_error_message("Vault SSH certificate signing error", message) + raise VoscaError from request_error ssh_cert: str = response.json()["data"]["signed_key"] return ssh_cert