Skip to content

Commit

Permalink
WIP: catch vault ssh sign
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaso committed Mar 31, 2024
1 parent 82b031c commit 353d702
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions vault_oidc_ssh_cert_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 353d702

Please sign in to comment.