From ea63a58b21545b516310c669bf9c8e139b67f2d6 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 28 May 2021 23:38:53 -0400 Subject: [PATCH] Port two more functions to new decorator --- api-daemon/pvcapid/helper.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/api-daemon/pvcapid/helper.py b/api-daemon/pvcapid/helper.py index 40304526..9f4efb6c 100755 --- a/api-daemon/pvcapid/helper.py +++ b/api-daemon/pvcapid/helper.py @@ -126,24 +126,22 @@ def restore_cluster(zkhandler, cluster_data_raw): # # Cluster functions # -def cluster_status(): +@ZKConnection(config) +def cluster_status(zkhandler): """ Get the overall status of the PVC cluster """ - zkhandler = pvc_common.startZKConnection(config['coordinators']) retflag, retdata = pvc_cluster.get_info(zkhandler) - pvc_common.stopZKConnection(zkhandler) return retdata, 200 -def cluster_maintenance(maint_state='false'): +@ZKConnection(config) +def cluster_maintenance(zkhandler, maint_state='false'): """ Set the cluster in or out of maintenance state """ - zkhandler = pvc_common.startZKConnection(config['coordinators']) retflag, retdata = pvc_cluster.set_maintenance(zkhandler, maint_state) - pvc_common.stopZKConnection(zkhandler) retdata = { 'message': retdata