Example #1
0
    def _sync_server_cluster(self):
        zkOper = Common_ZkOpers()
        cluster_uuid = zkOper.getClusterUUID()
        uuid_value, _ = zkOper.retrieveClusterProp(cluster_uuid)

        uuid_value = uuid_value.replace("'", "\"")
        uuid_value = json.loads(uuid_value)
        self.config_file_obj.setValue(options.server_cluster_property,
                                      uuid_value)
Example #2
0
    def syncExistedCluster(self, params):
        if params == {}:
            error_message = "please fill the cluster uuid!"
            raise UserVisiableException(error_message)

        clusterUUID = params['clusterUUID']
        zkOper = Common_ZkOpers()

        existCluster = zkOper.existCluster(clusterUUID)
        if not existCluster:
            error_message = "Nginx componentCluster does't exist(cluster id:%s), \
                 please specify the right cluster uuid!" % (clusterUUID)
            raise UserVisiableException(error_message)

        data, _ = zkOper.retrieveClusterProp(clusterUUID)
        logging.info("data in zk %s" % (data))
        json_str_data = data.replace("'", "\"")
        dict_data = json.loads(json_str_data)
        self.confOpers.setValue(options.cluster_property, dict_data)