From eb099d6302e0bcf4350d342687812759bcf8f603 Mon Sep 17 00:00:00 2001 From: Kalibh Halford Date: Thu, 16 Jan 2025 13:36:00 +0000 Subject: [PATCH] BUG: Token validation fails for secret entries that don't exist Change to using .get rather than indexing as we can return an empty string to the validate method which will fail for us. Whereas indexing doesn't let the validation function carry out fully as it errors early --- cloud-chatops/src/helper/read_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-chatops/src/helper/read_config.py b/cloud-chatops/src/helper/read_config.py index 90bcc94..ddca88f 100644 --- a/cloud-chatops/src/helper/read_config.py +++ b/cloud-chatops/src/helper/read_config.py @@ -42,7 +42,7 @@ def get_token(secret: str) -> str: path = get_path() with open(path + "secrets/secrets.yml", "r", encoding="utf-8") as secrets: secrets_data = yaml.safe_load(secrets) - return secrets_data[secret] + return secrets_data.get(secret, "") def get_config(section: str) -> Union[List, Dict, str]: