From 931c46bb5fef8383a26c817d1b36f13780f0be65 Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Tue, 10 Apr 2018 10:18:51 -0400 Subject: Fix DCAEGEN2-429 Change-Id: I713497b454c50f415fe50b2b057c4cb9b2d703e3 Issue-ID: DCAEGEN2-429 Signed-off-by: Tommy Carpenter --- config_binding_service/client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'config_binding_service') diff --git a/config_binding_service/client.py b/config_binding_service/client.py index 51ce3b1..a87c3bc 100644 --- a/config_binding_service/client.py +++ b/config_binding_service/client.py @@ -87,8 +87,11 @@ def _consul_get_all_as_transaction(service_component_name): new_res = {} for res in result: key = res["KV"]["Key"] - new_res[key] = json.loads(base64.b64decode( - res["KV"]["Value"]).decode("utf-8")) + val = base64.b64decode(res["KV"]["Value"]).decode("utf-8") + try: + new_res[key] = json.loads(val) + except json.decoder.JSONDecodeError: + new_res[key] = "INVALID JSON" # TODO, should we just include the original value somehow? if service_component_name not in new_res: raise CantGetConfig(404, "") -- cgit 1.2.3-korg