From ca3cac3ae8049db9badeff050c21128f338a1c43 Mon Sep 17 00:00:00 2001 From: Andreas Olsson Date: Sat, 30 Mar 2024 10:14:31 +0100 Subject: [PATCH] WIP: Start cathing --- vault_oidc_ssh_cert_action.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vault_oidc_ssh_cert_action.py b/vault_oidc_ssh_cert_action.py index de2bf7b..3785d15 100644 --- a/vault_oidc_ssh_cert_action.py +++ b/vault_oidc_ssh_cert_action.py @@ -62,9 +62,14 @@ def github_vault_auth() -> None: jwt_aud: str = _determine_audience(input_audience, vault_server) jwt_token: str = _issue_github_jwt(jwt_aud) - vault_token: str = _issue_vault_token( - vault_server, oidc_backend, oidc_role, jwt_token - ) + + try: + vault_token: str = _issue_vault_token( + vault_server, oidc_backend, oidc_role, jwt_token + ) + except requests.exceptions.HTTPError as http_error: + print(http_error.response.json()) + raise SystemExit from http_error print(f"::add-mask::{vault_token}") with open(os.environ["GITHUB_OUTPUT"], mode="a", encoding="utf-8") as ghof: