当前位置: 首页>>代码示例>>Python>>正文


Python RestConnection.get_ddoc方法代码示例

本文整理汇总了Python中membase.api.rest_client.RestConnection.get_ddoc方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.get_ddoc方法的具体用法?Python RestConnection.get_ddoc怎么用?Python RestConnection.get_ddoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在membase.api.rest_client.RestConnection的用法示例。


在下文中一共展示了RestConnection.get_ddoc方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _verify_ddoc_ops_all_buckets

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_ddoc [as 别名]
    def _verify_ddoc_ops_all_buckets(self):
        self.log.info("DDoc Validation Started")
        rest = RestConnection(self.master)
        # Iterate over all the DDocs/Views stored in the internal dictionary
        for bucket, self.ddoc_view_map in self.bucket_ddoc_map.items():
            for ddoc_name, view_list in self.ddoc_view_map.items():
                try:
                    # fetch the DDoc information from the database
                    ddoc_json, header = rest.get_ddoc(bucket, ddoc_name)
                    self.log.info("Database Document {0} details : {1}".format(ddoc_name, json.dumps(ddoc_json)))
                    ddoc = DesignDocument._init_from_json(ddoc_name, ddoc_json)
                    for view in view_list:
                        if view.name not in [v.name for v in ddoc.views]:
                            self.fail(
                                "Validation Error: View - {0} in Design Doc - {1} and Bucket - {2} is missing from database".format(
                                    view.name, ddoc_name, bucket
                                )
                            )

                except ReadDocumentException:
                    self.fail(
                        "Validation Error: Design Document - {0} is missing from Bucket - {1}".format(ddoc_name, bucket)
                    )

        self.log.info("DDoc Validation Successful")
开发者ID:mschoch,项目名称:testrunner,代码行数:27,代码来源:createdeleteview.py

示例2: execute

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_ddoc [as 别名]
    def execute(self, task_manager):

        rest = RestConnection(self.server)

        try:
            # remove view from existing design doc
            content = rest.get_ddoc(self.bucket, self.design_doc_name)
            ddoc = DesignDocument._init_from_json(self.design_doc_name, content)
            status = ddoc.delete_view(self.view)
            if not status:
                self.state = FINISHED
                self.set_exception(Exception('View does not exist! %s' % (self.view.name)))

            # update design doc
            rest.create_design_document(self.bucket, ddoc)
            self.state = CHECKING
            task_manager.schedule(self, 2)

        except (ValueError, ReadDocumentException, DesignDocCreationException) as e:
            self.state = FINISHED
            self.set_exception(e)

        #catch and set all unexpected exceptions
        except Exception as e:
            self.state = FINISHED
            self.log.info("Unexpected Exception Caught")
            self.set_exception(e)
开发者ID:jchris,项目名称:testrunner,代码行数:29,代码来源:task.py

示例3: create_primary_index_for_3_0_and_greater

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_ddoc [as 别名]
 def create_primary_index_for_3_0_and_greater(self):
     self.log.info("CHECK FOR PRIMARY INDEXES")
     rest = RestConnection(self.master)
     versions = rest.get_nodes_versions()
     ddoc_name = 'ddl_#primary'
     if versions[0].startswith("3"):
         try:
             rest.get_ddoc(self.buckets[0], ddoc_name)
         except ReadDocumentException:
             for bucket in self.buckets:
                 self.log.info("Creating primary index for %s ..." % bucket.name)
                 self.query = "CREATE PRIMARY INDEX ON %s " % (bucket.name)
                 try:
                     self.run_cbq_query()
                 except Exception, ex:
                     self.log.error('ERROR during index creation %s' % str(ex))
开发者ID:DavidAlphaFox,项目名称:couchbase,代码行数:18,代码来源:newtuq.py

示例4: verify_ddoc

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_ddoc [as 别名]
 def verify_ddoc(self, file):
     rest = RestConnection(self.master)
     ddoc_names = self.get_ddoc_names(file)
     for bucket in self.buckets:
         for ddoc_name in ddoc_names:
             ddoc_json, header = rest.get_ddoc(bucket, ddoc_name)
             if ddoc_json is not None:
                 self.log.info('Database Document {0} details : {1}'.format(ddoc_name, json.dumps(ddoc_json)))
             else:
                 raise Exception("ddoc %s is not imported" % ddoc_name)
开发者ID:DavidAlphaFox,项目名称:couchbase,代码行数:12,代码来源:docloadertest.py

示例5: _check_ddoc_revision

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_ddoc [as 别名]
    def _check_ddoc_revision(self):
        valid = False
        rest = RestConnection(self.server)

        try:
            content = rest.get_ddoc(self.bucket, self.design_doc_name)
            new_rev_id = self._parse_revision(content['_rev'])
            if new_rev_id != self.ddoc_rev_no:
                self.ddoc_rev_no = new_rev_id
                valid = True
        except ReadDocumentException:
            pass

        return valid
开发者ID:paul-guo-,项目名称:appstack,代码行数:16,代码来源:task.py

示例6: _verify_ddoc_ops_all_buckets

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_ddoc [as 别名]
    def _verify_ddoc_ops_all_buckets(self):
        rest = RestConnection(self.servers[0])
        for bucket, self.ddoc_view_map in self.bucket_ddoc_map.items():
            for ddoc_name, self.view_name_list in self.ddoc_view_map.items():
                try:
                    ddoc_json = rest.get_ddoc(bucket, ddoc_name)
                    self.log.info('Document {0} details : {1}'.format(ddoc_name,json.dumps(ddoc_json)))
                    ddoc = DesignDocument._init_from_json(ddoc_name, ddoc_json)
                    for view_name in self.view_name_list:
                        if view_name not in [view.name for view in ddoc.views]:
                            self.fail("Validation Error: View - {0} in Design Doc - {1} and Bucket - {2} is missing".format(view_name,ddoc_name, bucket))

                except ReadDocumentException:
                    self.fail("Validation Error: Design Document - {0} is missing".format(ddoc_name))
开发者ID:paul-guo-,项目名称:appstack,代码行数:16,代码来源:createdeleteview.py

示例7: _check_ddoc_revision

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_ddoc [as 别名]
    def _check_ddoc_revision(self):
        valid = False
        rest = RestConnection(self.server)

        try:
            content = rest.get_ddoc(self.bucket, self.design_doc_name)
            new_rev_id = self._parse_revision(content['_rev'])
            if new_rev_id != self.ddoc_rev_no:
                self.ddoc_rev_no = new_rev_id
                valid = True
        except ReadDocumentException:
            pass

        #catch and set all unexpected exceptions
        except Exception as e:
            self.state = FINISHED
            self.log.info("Unexpected Exception Caught")
            self.set_exception(e)

        return valid
开发者ID:jchris,项目名称:testrunner,代码行数:22,代码来源:task.py


注:本文中的membase.api.rest_client.RestConnection.get_ddoc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。