From b03b96b5fe3e02c2c03f907d8d3dcfd479db7220 Mon Sep 17 00:00:00 2001 From: lb584 <lb584@cam.ac.uk> Date: Wed, 19 Jun 2024 13:32:55 +0100 Subject: [PATCH] adding warning when using double tokens in configs --- ews/coordinator/utils/processor_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ews/coordinator/utils/processor_utils.py b/ews/coordinator/utils/processor_utils.py index 2ff6104..6bffe56 100644 --- a/ews/coordinator/utils/processor_utils.py +++ b/ews/coordinator/utils/processor_utils.py @@ -138,10 +138,11 @@ def parse_json_file_with_tokens(file_path: str, tokens: dict = None) -> dict: # reparse the string with any other tokens passed in as arguments parsed_file_string: str = Template(parsed_file_string).safe_substitute(**tokens) - if "${" in file_string: + if "${" in parsed_file_string: logger.warning(f"\n\nUNRESOLVED TOKENS IN THE CONFIG FILE: {file_path} - THIS MAY BE BECAUSE YOU ARE DECLARING " - f"VALUES WHICH INCLUDE A TOKEN, WHERE THE VALUE OF THE TOKEN ITS SELF USES A TOKEN. YOU CAN " + f"VALUES WHICH INCLUDE A TOKEN, WHERE THE VALUE OF THE TOKEN ITSSELF USES A TOKEN. YOU CAN " f"NOT DECLARE TOKENS WHICH DEPEND ON OTHER TOKENS\n\n") + logger.warning(f"UNRESOLVED TOKENS: {parsed_file_string}") # finally, parse the tokenized string as a json dict result = json.loads(parsed_file_string) -- GitLab