Exemplo n.º 1
0
    def consume_fts_index(
            opts, sink_spec: str, sink_map, source_bucket, source_map,
            source_design: Union[str, bytes]) -> couchbaseConstants.PUMP_ERROR:
        if not source_design:
            return 0

        try:
            index_defs = json.loads(source_design)
            if not index_defs:
                return 0
        except ValueError as e:
            return f'error: could not parse fts index definitions; exception: {e!s}'

        try:
            username = opts.username
            password = opts.password
            if opts.username_dest is not None and opts.password_dest is not None:
                username = opts.username_dest
                password = opts.password_dest
            rest = ClusterManager(sink_spec, username, password, opts.ssl,
                                  opts.no_ssl_verify, opts.cacert, False)
            _, errors = rest.restore_fts_index_metadata(index_defs)
            return errors
        except ServiceNotAvailableException as e:
            return "No fts service in cluster, skipping restore of aliases"
Exemplo n.º 2
0
    def consume_fts_alias(opts, sink_spec: str, sink_map, source_bucket,
                          source_map, source_design: Union[str, bytes]) -> couchbaseConstants.PUMP_ERROR:
        if not source_design:
            return 0
        try:
            index_defs = json.loads(source_design)
            if not index_defs:
                return 0
        except ValueError as e:
            return f'error: could not parse fts index definitions; exception: {e!s}'

        try:
            username = opts.username
            password = opts.password
            if opts.username_dest is not None and opts.password_dest is not None:
                username = opts.username_dest
                password = opts.password_dest
            rest = ClusterManager(sink_spec, username, password, opts.ssl, opts.no_ssl_verify,
                                  opts.cacert, False)
            _, errors = rest.restore_fts_index_metadata(index_defs)
            return errors
        except ServiceNotAvailableException as e:
            return "No fts service in cluster, skipping restore of indexes"
Exemplo n.º 3
0
                          source_design):
        if not source_design:
            return 0

        try:
            index_defs = json.loads(source_design)
            if not index_defs:
                return 0
        except ValueError, e:
            return "error: could not parse fts index definitions; exception: %s" % (
                e)

        try:
            rest = ClusterManager(sink_spec, opts.username, opts.password,
                                  opts.ssl, False, None, False)
            _, errors = rest.restore_fts_index_metadata(index_defs)
            return errors
        except ServiceNotAvailableException, e:
            return "No fts service in cluster, skipping restore of indexes"

    @staticmethod
    def consume_index(opts, sink_spec, sink_map, source_bucket, source_map,
                      source_design):
        if not source_design:
            return 0

        try:
            sd = json.loads(source_design)
            if not sd:
                return 0
        except ValueError, e:
Exemplo n.º 4
0
    @staticmethod
    def consume_fts_index(opts, sink_spec, sink_map, source_bucket, source_map, source_design):
        if not source_design:
            return 0

        try:
            index_defs = json.loads(source_design)
            if not index_defs:
               return 0
        except ValueError, e:
            return "error: could not parse fts index definitions; exception: %s" % (e)

        try:
            rest = ClusterManager(sink_spec, opts.username, opts.password, opts.ssl, False,
                                  None, False)
            _, errors = rest.restore_fts_index_metadata(index_defs)
            return errors
        except ServiceNotAvailableException, e:
            return "No fts service in cluster, skipping restore of indexes"

    @staticmethod
    def consume_index(opts, sink_spec, sink_map, source_bucket, source_map, source_design):
        if not source_design:
            return 0

        try:
            sd = json.loads(source_design)
            if not sd:
               return 0
        except ValueError, e:
            return "error: could not parse source design; exception: %s" % (e)