diff --git a/vault_oidc_ssh_cert_action.py b/vault_oidc_ssh_cert_action.py index bdc7475..ea421f5 100644 --- a/vault_oidc_ssh_cert_action.py +++ b/vault_oidc_ssh_cert_action.py @@ -21,8 +21,9 @@ def _issue_github_jwt(jwt_aud: str) -> str: headers = {"Authorization": f"Bearer {req_token}"} response = requests.get(full_url, headers=headers, timeout=10) - jwt_token: str = response.json()["value"] + response.raise_for_status() + jwt_token: str = response.json()["value"] return jwt_token @@ -33,8 +34,9 @@ def _issue_vault_token( payload = {"jwt": jwt_token, "role": oidc_role} response = requests.post(login_url, data=payload, timeout=10) - vault_token: str = response.json()["auth"]["client_token"] + response.raise_for_status() + vault_token: str = response.json()["auth"]["client_token"] return vault_token @@ -46,8 +48,9 @@ def _issue_ssh_cert( payload = {"public_key": pubkey} response = requests.post(issue_url, headers=headers, data=payload, timeout=10) - ssh_cert: str = response.json()["data"]["signed_key"] + response.raise_for_status() + ssh_cert: str = response.json()["data"]["signed_key"] return ssh_cert