From 8f2ffe2691ef7d6fcd0ae7014a87d69f14c7973f Mon Sep 17 00:00:00 2001 From: shloka-bhalgat-unskript Date: Wed, 24 Apr 2024 12:59:09 +0530 Subject: [PATCH] Add keys to checks result --- .../legos/k8s_get_pending_pods/k8s_get_pending_pods.py | 2 +- .../mongodb_get_server_status/mongodb_get_server_status.py | 2 +- Redis/legos/redis_list_large_keys/redis_list_large_keys.py | 2 +- .../vault_get_service_health/vault_get_service_health.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Kubernetes/legos/k8s_get_pending_pods/k8s_get_pending_pods.py b/Kubernetes/legos/k8s_get_pending_pods/k8s_get_pending_pods.py index b8fc29d5c..66dfcd7bf 100644 --- a/Kubernetes/legos/k8s_get_pending_pods/k8s_get_pending_pods.py +++ b/Kubernetes/legos/k8s_get_pending_pods/k8s_get_pending_pods.py @@ -59,7 +59,7 @@ def k8s_get_pending_pods(handle, namespace:str="") -> Tuple: pod_namespace = pod['metadata']['namespace'] if status == 'Pending': - pending_pods.append([name, pod_namespace]) + pending_pods.append({"pod_name":name,"namespace":pod_namespace}) if len(pending_pods) != 0: return (False, pending_pods) diff --git a/Mongo/legos/mongodb_get_server_status/mongodb_get_server_status.py b/Mongo/legos/mongodb_get_server_status/mongodb_get_server_status.py index fcb93050f..8bf640bc6 100644 --- a/Mongo/legos/mongodb_get_server_status/mongodb_get_server_status.py +++ b/Mongo/legos/mongodb_get_server_status/mongodb_get_server_status.py @@ -35,4 +35,4 @@ def mongodb_get_server_status(handle) -> Tuple: return (True, None) except Exception as e: return (False, str(e)) - return (False, "Unable to check Mongo server status") + return (False, {"message":"Unable to check Mongo server status"}) diff --git a/Redis/legos/redis_list_large_keys/redis_list_large_keys.py b/Redis/legos/redis_list_large_keys/redis_list_large_keys.py index be4642cb9..3a3c6bf40 100644 --- a/Redis/legos/redis_list_large_keys/redis_list_large_keys.py +++ b/Redis/legos/redis_list_large_keys/redis_list_large_keys.py @@ -47,7 +47,7 @@ def redis_list_large_keys(handle, size_in_bytes: int = 5368709120) -> Tuple : for key in keys: value = handle.memory_usage(key) if value > int(size_in_bytes): - large_key = {key.decode('utf-8'): value} + large_key = {"large_key": key.decode('utf-8'), "value": value} result.append(large_key) except Exception as e: raise e diff --git a/Vault/legos/vault_get_service_health/vault_get_service_health.py b/Vault/legos/vault_get_service_health/vault_get_service_health.py index 8ff588b9b..123aade09 100644 --- a/Vault/legos/vault_get_service_health/vault_get_service_health.py +++ b/Vault/legos/vault_get_service_health/vault_get_service_health.py @@ -36,11 +36,11 @@ def vault_get_service_health(handle) -> Tuple: else: error_msg = [] if not health_data["initialized"]: - error_msg.append("Vault is not initialized.") + error_msg.append({"message":"Vault is not initialized."}) if health_data["standby"]: - error_msg.append("Vault is in standby mode.") + error_msg.append({"message":"Vault is in standby mode."}) if health_data["sealed"]: - error_msg.append("Vault is sealed.") + error_msg.append({"message": "Vault is sealed."}) return (False, error_msg) except Exception as e: