Port two more functions to new decorator

This commit is contained in:
Joshua Boniface 2021-05-28 23:38:53 -04:00
parent 0eceec0341
commit ea63a58b21
1 changed files with 4 additions and 6 deletions

View File

@ -126,24 +126,22 @@ def restore_cluster(zkhandler, cluster_data_raw):
# #
# Cluster functions # Cluster functions
# #
def cluster_status(): @ZKConnection(config)
def cluster_status(zkhandler):
""" """
Get the overall status of the PVC cluster Get the overall status of the PVC cluster
""" """
zkhandler = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_cluster.get_info(zkhandler) retflag, retdata = pvc_cluster.get_info(zkhandler)
pvc_common.stopZKConnection(zkhandler)
return retdata, 200 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 Set the cluster in or out of maintenance state
""" """
zkhandler = pvc_common.startZKConnection(config['coordinators'])
retflag, retdata = pvc_cluster.set_maintenance(zkhandler, maint_state) retflag, retdata = pvc_cluster.set_maintenance(zkhandler, maint_state)
pvc_common.stopZKConnection(zkhandler)
retdata = { retdata = {
'message': retdata 'message': retdata