當前位置: 首頁>>代碼示例>>Python>>正文


Python Admin.get_dbs方法代碼示例

本文整理匯總了Python中libraries.testkit.admin.Admin.get_dbs方法的典型用法代碼示例。如果您正苦於以下問題:Python Admin.get_dbs方法的具體用法?Python Admin.get_dbs怎麽用?Python Admin.get_dbs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在libraries.testkit.admin.Admin的用法示例。


在下文中一共展示了Admin.get_dbs方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from libraries.testkit.admin import Admin [as 別名]
# 或者: from libraries.testkit.admin.Admin import get_dbs [as 別名]
class SyncGateway:

    def __init__(self, cluster_config, target):
        self.ansible_runner = AnsibleRunner(cluster_config)
        self.ip = target["ip"]
        self.url = "http://{}:4984".format(target["ip"])
        self.hostname = target["name"]
        self._headers = {'Content-Type': 'application/json'}
        self.admin = Admin(self)

    def info(self):
        r = requests.get(self.url)
        r.raise_for_status()
        return r.text

    def stop(self):
        status = self.ansible_runner.run_ansible_playbook(
            "stop-sync-gateway.yml",
            subset=self.hostname
        )
        return status

    def start(self, config):

        conf_path = os.path.abspath(config)

        log.info(">>> Starting sync_gateway with configuration: {}".format(conf_path))

        status = self.ansible_runner.run_ansible_playbook(
            "start-sync-gateway.yml",
            extra_vars={
                "sync_gateway_config_filepath": conf_path
            },
            subset=self.hostname
        )
        return status

    def restart(self, config):
        conf_path = os.path.abspath(config)

        log.info(">>> Restarting sync_gateway with configuration: {}".format(conf_path))

        status = self.ansible_runner.run_ansible_playbook(
            "reset-sync-gateway.yml",
            extra_vars={
                "sync_gateway_config_filepath": conf_path,
            },
            subset=self.hostname
        )
        return status

    def verify_launched(self):
        r = requests.get(self.url)
        log.info("GET {} ".format(r.url))
        log.info("{}".format(r.text))
        r.raise_for_status()

    def create_db(self, name):
        return self.admin.create_db(name)

    def delete_db(self, name):
        return self.admin.delete_db(name)

    def reset(self):
        dbs = self.admin.get_dbs()
        for db in dbs:
            self.admin.delete_db(db)

    def start_push_replication(self,
                               target,
                               source_db,
                               target_db,
                               continuous=True,
                               use_remote_source=False,
                               channels=None,
                               async=False,
                               use_admin_url=False):
開發者ID:couchbaselabs,項目名稱:mobile-testkit,代碼行數:79,代碼來源:syncgateway.py


注:本文中的libraries.testkit.admin.Admin.get_dbs方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。