From da00225913a13c91967a209627ad214805a32d98 Mon Sep 17 00:00:00 2001 From: jdorsch Date: Thu, 17 Oct 2024 12:28:54 +0200 Subject: [PATCH 1/2] only log on debug mode --- deploy/demo/common/common.env | 3 ++- deploy/k8s/values-dev.yaml | 3 ++- src/common/cscs_api_common.py | 8 +++++--- src/tests/automated_tests/unit/test_unit_status.py | 3 ++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/deploy/demo/common/common.env b/deploy/demo/common/common.env index 3e207084..debec473 100644 --- a/deploy/demo/common/common.env +++ b/deploy/demo/common/common.env @@ -59,7 +59,8 @@ F7T_SYSTEMS_PUBLIC_NAME='cluster;cluster' # {'name':'SCRATCH', 'path':'/home', 'description':'Home filesystem'}] }" F7T_FILESYSTEMS="{ 'cluster': [{'name':'HOME', 'path':'/home', 'description':'Users home filesystem'} , - {'name':'SCRATCH', 'path':'/scratch', 'description':'Scratch filesystem'}] + {'name':'SCRATCH', 'path':'/scratch', 'description':'Scratch filesystem'}, + {'name':'PROJECT', 'path':'/project', 'description':'Projects filesystem'}, ] } " #internal machines that microservices connect to (in correlation with SYSTEMS_PUBLIC) F7T_SYSTEMS_INTERNAL_ADDR='192.168.220.12:22;192.168.220.12:22' diff --git a/deploy/k8s/values-dev.yaml b/deploy/k8s/values-dev.yaml index 15d78e8f..fc2cf4cf 100644 --- a/deploy/k8s/values-dev.yaml +++ b/deploy/k8s/values-dev.yaml @@ -15,7 +15,8 @@ F7T_CERTIFICATOR_HOST: svc-certificator F7T_COMPUTE_HOST: svc-compute F7T_FILESYSTEMS: "{ 'cluster': [{'name':'HOME', 'path':'/home', 'description':'Users home filesystem'} , - {'name':'SCRATCH', 'path':'/scratch', 'description':'Scratch filesystem'}] + {'name':'SCRATCH', 'path':'/scratch', 'description':'Scratch filesystem'}, + {'name':'PROJECT', 'path':'/project', 'description':'Projects filesystem'}, ] } " F7T_GUNICORN_SSL: --ciphers TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256,TLS_AES_128_GCM_SHA256,DHE-RSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-RSA-AES128-GCM-SHA256 --ssl-version TLSv1_2 --keyfile /f7t-ssl.key --certfile /f7t-ssl.crt F7T_JAEGER_AGENT: svc-jaeger diff --git a/src/common/cscs_api_common.py b/src/common/cscs_api_common.py index 39d42fa7..89d706d1 100644 --- a/src/common/cscs_api_common.py +++ b/src/common/cscs_api_common.py @@ -167,7 +167,8 @@ def check_header(header): except jwt.exceptions.InvalidSignatureError: decoding_reason = "JWT token has invalid signature" - logging.error(decoding_reason, exc_info=False) + if DEBUG_MODE: + logging.debug(decoding_reason, exc_info=False) # try next key continue except jwt.exceptions.ExpiredSignatureError: @@ -245,7 +246,7 @@ def get_username(header): algorithms=[auth_pubkey["alg"]], audience=AUTH_AUDIENCE) if DEBUG_MODE: - logging.info("Correctly decoded") + logging.debug("Correctly decoded") # if token is correctly decoded, exit the loop decoding_result = True @@ -253,7 +254,8 @@ def get_username(header): except jwt.exceptions.InvalidSignatureError: decoding_reason = "JWT token has invalid signature" - logging.error(decoding_reason, exc_info=False) + if DEBUG_MODE: + logging.debug(decoding_reason, exc_info=False) # try next key continue except jwt.exceptions.ExpiredSignatureError: diff --git a/src/tests/automated_tests/unit/test_unit_status.py b/src/tests/automated_tests/unit/test_unit_status.py index 5ecde9ff..606fdb79 100644 --- a/src/tests/automated_tests/unit/test_unit_status.py +++ b/src/tests/automated_tests/unit/test_unit_status.py @@ -39,7 +39,8 @@ def test_status_system(system, headers): for system in SYSTEMS: STATUS_CODES_SYSTEMS.append((system,200)) STATUS_CODES_FS.append((system,"HOME",200)) - STATUS_CODES_FS.append((system,"SCRATCH",400)) + STATUS_CODES_FS.append((system,"SCRATCH",200)) + STATUS_CODES_FS.append((system,"PROJECT",400)) STATUS_CODES_SYSTEMS.append(("not-a-system",404)) From 102633e38895a3616ca9ea5b824fd0f979bbdd1b Mon Sep 17 00:00:00 2001 From: jdorsch Date: Thu, 17 Oct 2024 12:48:57 +0200 Subject: [PATCH 2/2] changed fs tests --- src/tests/automated_tests/unit/test_unit_status.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tests/automated_tests/unit/test_unit_status.py b/src/tests/automated_tests/unit/test_unit_status.py index 606fdb79..70bc4b9a 100644 --- a/src/tests/automated_tests/unit/test_unit_status.py +++ b/src/tests/automated_tests/unit/test_unit_status.py @@ -39,7 +39,6 @@ def test_status_system(system, headers): for system in SYSTEMS: STATUS_CODES_SYSTEMS.append((system,200)) STATUS_CODES_FS.append((system,"HOME",200)) - STATUS_CODES_FS.append((system,"SCRATCH",200)) STATUS_CODES_FS.append((system,"PROJECT",400)) STATUS_CODES_SYSTEMS.append(("not-a-system",404))