Skip to content

Commit

Permalink
WIP: catch oidc token error
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaso committed Mar 31, 2024
1 parent 085e643 commit a79918e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions vault_oidc_ssh_cert_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ def _issue_github_jwt(jwt_aud: str) -> str:
full_url = f"{req_url}&audience={jwt_aud}"
headers = {"Authorization": f"Bearer {req_token}"}

response = requests.get(full_url, headers=headers, timeout=10)
response.raise_for_status()
try:
response = requests.get(full_url, headers=headers, timeout=10)
response.raise_for_status()
except requests.exceptions.RequestException as request_error:
title = "GitHub OIDC JWT token issuing error"
message = f"{type(request_error).__name__}: {str(request_error)}"
_set_error_message(title, message)
raise VoscaError(title) from request_error

jwt_token: str = response.json()["value"]
return jwt_token
Expand Down

0 comments on commit a79918e

Please sign in to comment.