From 7ad155d02e8eddea9944a8f67346e01180778b16 Mon Sep 17 00:00:00 2001 From: Alexis Lucattini Date: Mon, 27 May 2024 10:14:20 +1000 Subject: [PATCH] Hot fix - debug authentication issues --- Changelog.md | 9 +++++++++ deploy/cttso-ica-to-pieriandx-cdk/Changelog.md | 9 +++++++++ .../assets/cttso-ica-to-pieriandx-wrapper.sh | 9 ++++++--- scripts/cttso-ica-to-pieriandx.py | 1 + utils/accession.py | 5 +++++ utils/pieriandx_helper.py | 2 +- 6 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index 63e0d40..0ef4fe6 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,15 @@ Changes in this log refer only to changes that make it to the 'main' branch. and For changes in deployment, please see the [deployment changelog](deploy/cttso-ica-to-pieriandx-cdk/Changelog.md) +## 2024-05-27 + +> Author: Alexis Lucattini +> Email: [Alexis.Lucattini@umccr.org](mailto:alexis.lucattini@umccr.org) + +### Hotfix + +* Debug authentication issues (https://github.com/umccr/cttso-ica-to-pieriandx/issues/229) + ## 2024-05-06 > Author: Alexis Lucattini diff --git a/deploy/cttso-ica-to-pieriandx-cdk/Changelog.md b/deploy/cttso-ica-to-pieriandx-cdk/Changelog.md index 7c68594..0b93fbf 100644 --- a/deploy/cttso-ica-to-pieriandx-cdk/Changelog.md +++ b/deploy/cttso-ica-to-pieriandx-cdk/Changelog.md @@ -3,6 +3,15 @@ Changes in this log refer only to changes that make it to the 'main' branch and are nested under deploy/cttso-ica-to-pieriandx-cdk. +## 2024-05-27 + +> Author: Alexis Lucattini +> Email: [Alexis.Lucattini@umccr.org](mailto:alexis.lucattini@umccr.org) + +### Hotfix + +* Debug authentication issues (https://github.com/umccr/cttso-ica-to-pieriandx/issues/229) + ## 2024-05-23 > Author: Alexis Lucattini diff --git a/deploy/cttso-ica-to-pieriandx-cdk/assets/cttso-ica-to-pieriandx-wrapper.sh b/deploy/cttso-ica-to-pieriandx-cdk/assets/cttso-ica-to-pieriandx-wrapper.sh index 4325a1a..21f9a43 100644 --- a/deploy/cttso-ica-to-pieriandx-cdk/assets/cttso-ica-to-pieriandx-wrapper.sh +++ b/deploy/cttso-ica-to-pieriandx-cdk/assets/cttso-ica-to-pieriandx-wrapper.sh @@ -189,9 +189,12 @@ PIERIANDX_AWS_SECRET_ACCESS_KEY="$( # Collect the pieriandx access token # We assume that there is more than 5 minutes left on the clock while :; do - PIERIANDX_USER_AUTH_TOKEN="$(get_pieriandx_access_token)" - [[ -z "${PIERIANDX_USER_AUTH_TOKEN}" ]] || break - sleep 10 + echo_stderr "Collecting PierianDx access token..." + if ! PIERIANDX_USER_AUTH_TOKEN="$(get_pieriandx_access_token)"; then + sleep 10 + else + break + fi done # Export env vars diff --git a/scripts/cttso-ica-to-pieriandx.py b/scripts/cttso-ica-to-pieriandx.py index 2e6d9d7..4e2ed31 100644 --- a/scripts/cttso-ica-to-pieriandx.py +++ b/scripts/cttso-ica-to-pieriandx.py @@ -3,6 +3,7 @@ """ Run sample on ICA to PierianDx """ +from __future__ import annotations from typing import Dict, Match from pathlib import Path diff --git a/utils/accession.py b/utils/accession.py index c294543..ebceadd 100644 --- a/utils/accession.py +++ b/utils/accession.py @@ -85,6 +85,11 @@ def get_cases_df() -> pd.DataFrame: logger.debug("Printing response") if response is None: logger.warning(f"Trying again to get cases - attempt {iter_count}") + logger.warning(f"Client vars were: " + f"'baseurl': {pyriandx_client.baseURL}, " + f"'email': {pyriandx_client.headers['X-Auth-Email']}, " + f"'institution': {pyriandx_client.headers['X-Auth-Institution']}, " + f"'Token': {pyriandx_client.headers['X-Auth-Token'][:5]}***{pyriandx_client.headers['X-Auth-Token'][-5:]}") time.sleep(LIST_CASES_RETRY_TIME) else: break diff --git a/utils/pieriandx_helper.py b/utils/pieriandx_helper.py index c13a056..55b6637 100644 --- a/utils/pieriandx_helper.py +++ b/utils/pieriandx_helper.py @@ -51,4 +51,4 @@ def get_pieriandx_client(email: str = environ.get("PIERIANDX_USER_EMAIL", None), key=token, institution=instiution, base_url=base_url, - key_is_auth_token=True) \ No newline at end of file + key_is_auth_token=True)