def post(self): requestParam = self.get_all_arguments() zkOper = Requests_ZkOpers() existCluster = zkOper.existCluster() if existCluster: clusterUUID = zkOper.getClusterUUID() else: clusterUUID = str(uuid.uuid1()) requestParam.setdefault("clusterUUID", clusterUUID) if requestParam != {}: self.confOpers.setValue(options.server_cluster_property, requestParam) self.confOpers.setValue(options.data_node_property, requestParam) clusterProps = self.confOpers.getValue(options.server_cluster_property) dataNodeProprs = self.confOpers.getValue(options.data_node_property) zkOper.writeClusterInfo(clusterUUID, clusterProps) zkOper.writeDataNodeInfo(clusterUUID, dataNodeProprs) return_message = {} return_message.setdefault("message", "creating server cluster successful!") self.finish(return_message)
def get(self): zkOper = Requests_ZkOpers() clusterUUID = zkOper.getClusterUUID() data, _ = zkOper.retrieveClusterProp(clusterUUID) self.confOpers.setValue(options.server_cluster_property, eval(data)) result = {} result.setdefault("message", "sync server cluster info to local successful!") self.finish(result)