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


Python RemoteMachineShellConnection.download_binary_in_win方法代码示例

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


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

示例1: install

# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import download_binary_in_win [as 别名]
 def install(self, params):
     #        log = logger.new_logger("Installer")
     build = self.build_url(params)
     remote_client = RemoteMachineShellConnection(params["server"])
     info = remote_client.extract_remote_info()
     type = info.type.lower()
     server = params["server"]
     if "vbuckets" in params:
         vbuckets = int(params["vbuckets"][0])
     else:
         vbuckets = None
     if type == "windows":
         build = self.build_url(params)
         remote_client.download_binary_in_win(build.url, params["product"], params["version"])
         remote_client.membase_install_win(build, params["version"])
     else:
         downloaded = remote_client.download_build(build)
         if not downloaded:
             log.error(downloaded, "unable to download binaries : {0}".format(build.url))
         path = server.data_path or "/tmp"
         remote_client.membase_install(build, path=path, vbuckets=vbuckets)
         ready = RestHelper(RestConnection(params["server"])).is_ns_server_running(60)
         if not ready:
             log.error("membase-server did not start...")
         log.info("wait 5 seconds for membase server to start")
         time.sleep(5)
开发者ID:mschoch,项目名称:testrunner,代码行数:28,代码来源:install.py

示例2: _install_and_upgrade

# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import download_binary_in_win [as 别名]
    def _install_and_upgrade(self, initial_version='1.6.5.3',
                             initialize_cluster=False,
                             create_buckets=False,
                             insert_data=False):
        log = logger.Logger.get_logger()
        input = TestInputSingleton.input
        version = input.test_params['version']
        rest_settings = input.membase_settings
        servers = input.servers
        server = servers[0]
        is_amazon = False
        if input.test_params.get('amazon',False):
            is_amazon = True
        remote = RemoteMachineShellConnection(server)
        rest = RestConnection(server)
        info = remote.extract_remote_info()
        remote.membase_uninstall()
        remote.couchbase_uninstall()
        builds, changes = BuildQuery().get_all_builds()
        #release_builds = BuildQuery().get_all_release_builds(initial_version)

        #if initial_version == "1.7.2":
         #   initial_version = "1.7.2r-20"
        older_build = BuildQuery().find_membase_release_build(deliverable_type=info.deliverable_type,
                                                              os_architecture=info.architecture_type,
                                                              build_version=initial_version,
                                                              product='membase-server-enterprise', is_amazon=is_amazon)
        if info.type.lower() == 'windows':
            if older_build.product_version.startswith("1.8"):
                abbr_product = "cb"
            else:
                abbr_product = "mb"
            remote.download_binary_in_win(older_build.url, abbr_product, initial_version)
            remote.membase_install_win(older_build, initial_version)
            RestHelper(rest).is_ns_server_running(testconstants.NS_SERVER_TIMEOUT)
            rest.init_cluster_port(rest_settings.rest_username, rest_settings.rest_password)
            bucket_data = {}
            if initialize_cluster:
                rest.init_cluster_memoryQuota(memoryQuota=rest.get_nodes_self().mcdMemoryReserved)
                if create_buckets:
                    _create_load_multiple_bucket(self, server, bucket_data, howmany=2)
            if version.startswith("1.8"):
                abbr_product = "cb"
            appropriate_build = _get_build(servers[0], version, is_amazon=is_amazon)
            self.assertTrue(appropriate_build.url, msg="unable to find build {0}".format(version))
            remote.download_binary_in_win(appropriate_build.url, abbr_product, version)
            remote.stop_membase()
            log.info("###### START UPGRADE. #########")
            remote.membase_upgrade_win(info.architecture_type, info.windows_name, version, initial_version)
            remote.disconnect()
            RestHelper(rest).is_ns_server_running(testconstants.NS_SERVER_TIMEOUT)

            pools_info = rest.get_pools_info()

            rest.init_cluster_port(rest_settings.rest_username, rest_settings.rest_password)
            time.sleep(TIMEOUT_SECS)
            # verify admin_creds still set

            self.assertTrue(pools_info['implementationVersion'], appropriate_build.product_version)
            if initialize_cluster:
                #TODO: how can i verify that the cluster init config is preserved
                if create_buckets:
                    self.assertTrue(BucketOperationHelper.wait_for_bucket_creation('bucket-0', rest),
                                    msg="bucket 'default' does not exist..")
                if insert_data:
                    buckets = rest.get_buckets()
                    for bucket in buckets:
                        BucketOperationHelper.keys_exist_or_assert(bucket_data[bucket.name]["inserted_keys"],
                                                                   server,
                                                                   bucket.name, self)
        else:
            log.error("This is not windows server!")
开发者ID:jchris,项目名称:testrunner,代码行数:74,代码来源:upgradetests-win.py

示例3: test_win_uninstall_standalone

# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import download_binary_in_win [as 别名]
    def test_win_uninstall_standalone(self):
        query = BuildQuery()
        builds, changes = query.get_all_builds()
        os_version = self.input.test_params['win']

        task = 'uninstall'
        ex_type = 'exe'
        bat_file = 'uninstall.bat'
        version_file = 'VERSION.txt'
        if self.input.test_params["ostype"] == '64':
            Arch = 'x86_64'
            os_type = '64'
        elif self.input.test_params["ostype"] == '32':
            Arch = 'x86'
            os_type = '32'
        else:
            ok = False
            self.log.error("Unknown os version.")

        product = self.input.test_params["product"]
        if product == 'cse':
            name = 'couchbase-server-enterprise'
        elif product == 'csse':
            name = 'couchbase-single-server-enterprise'
        elif product == 'csc':
            name = 'couchbase-server-community'
        elif product == 'cssc':
            name = 'couchbase-single-server-community'
        else:
            self.log.error("Unknon product type.")

        # no need later
        cb_server_alias = ['cse','csc']
        cb_single_alias = ['csse','cssc']
        if product in cb_server_alias:
            server_path = "/cygdrive/c/Program Files/Couchbase/Server/"
        elif product in cb_single_alias:
            server_path = "/cygdrive/c/Program Files (x86)/Couchbase/Server/"

        for serverInfo in self.servers:
                remote_client = RemoteMachineShellConnection(serverInfo)
                info = RemoteMachineShellConnection(serverInfo).extract_remote_info()

                exist = remote_client.file_exists(server_path, version_file)
                if exist:
                    build_name, version = remote_client.find_build_version(server_path, version_file)
                    self.log.info('build needed to do auto uninstall {0}'.format(build_name))
                    # find installed build in tmp directory
                    build_name = build_name.rstrip() + ".exe"
                    self.log.info('Check if {0} is in tmp directory'.format(build_name))
                    exist = remote_client.file_exists("/cygdrive/c/tmp/", build_name)
                    if not exist:
                        build = query.find_build(builds, name, ex_type, Arch, version)
                        downloaded = remote_client.download_binary_in_win(build.url,product,version)
                        if downloaded:
                            self.log.info('Successful download {0}_{1}.exe'.format(product, version))
                        else:
                            self.log.error('Download {0}_{1}.exe failed'.format(product, version))
                    # modify uninstall bat file to change build name.
                    remote_client.modify_bat_file('/cygdrive/c/automation', bat_file,
                                                      product, os_type, os_version, version, task)
                    self.log.info('sleep for 5 seconds before running task schedule uninstall')
                    time.sleep(5)
                    # run task schedule to uninstall Couchbase Server
                    self.log.info('Start to uninstall couchbase {0}_{1}'.format(product, version))
                    output, error = remote_client.execute_command("cmd /c schtasks /run /tn removeme")
                    remote_client.log_command_output(output, error)
                    remote_client.wait_till_file_deleted(server_path, version_file, timeout_in_seconds=600)
                    self.log.info('sleep 15 seconds before running the next job ...')
                    time.sleep(15)
                else:
                    self.log.info('Couchbase server may not install on this server')
开发者ID:jchris,项目名称:testrunner,代码行数:74,代码来源:install.py

示例4: test_win_install

# 需要导入模块: from remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from remote.remote_util.RemoteMachineShellConnection import download_binary_in_win [as 别名]
    def test_win_install(self):
        query = BuildQuery()
        builds, changes = query.get_all_builds()
        version = self.input.test_params['version']
        os_version = self.input.test_params['win']

        task = 'install'
        ok = True
        ex_type = 'exe'
        bat_file = 'install.bat'
        version_file = 'VERSION.txt'
        if self.input.test_params["ostype"] == '64':
            Arch = 'x86_64'
            os_type = '64'
        elif self.input.test_params["ostype"] == '32':
            Arch = 'x86'
            os_type = '32'
        else:
            ok = False
            self.log.error("Unknown os version.")

        product = self.input.test_params["product"]
        if product == 'cse':
            name = 'couchbase-server-enterprise'
        elif product == 'csse':
            name = 'couchbase-single-server-enterprise'
        elif product == 'csc':
            name = 'couchbase-server-community'
        elif product == 'cssc':
            name = 'couchbase-single-server-community'
        else:
            ok = False
            self.log.error("Unknon product type.")

        cb_server_alias = ['cse','csc']
        cb_single_alias = ['csse','cssc']
        if product in cb_server_alias:
            server_path = "/cygdrive/c/Program Files/Couchbase/Server/"
        elif product in cb_single_alias:
            server_path = "/cygdrive/c/Program Files (x86)/Couchbase/Server/"

        if ok:
            for serverInfo in self.servers:
                remote_client = RemoteMachineShellConnection(serverInfo)
                info = RemoteMachineShellConnection(serverInfo).extract_remote_info()
                build = query.find_build(builds, name, ex_type, Arch, version)
                #self.log.info("what is this {0}".format(build.url))
                # check if previous couchbase server installed
                exist = remote_client.file_exists("/cygdrive/c/Program Files/Couchbase/Server/", version_file)
                if exist:
                    # call uninstall function to install couchbase server
                    self.log.info("Start uninstall cb server on this server")
                    self.test_win_uninstall(remote_client, product, os_type, os_version, version, server_path)
                else:
                    self.log.info('I am free. You can install couchbase server now')
                # directory path in remote server used to create or delete directory
                dir_paths = ['/cygdrive/c/automation','/cygdrive/c/tmp']
                remote_client.create_multiple_dir(dir_paths)
                # copy files from local server to remote server
                remote_client.copy_files_local_to_remote('resources/windows/automation', '/cygdrive/c/automation')
                downloaded = remote_client.download_binary_in_win(build.url,product,version)
                if downloaded:
                    self.log.info('Successful download {0}_{1}.exe'.format(product, version))
                else:
                    self.log.error('Download {0}_{1}.exe failed'.format(product, version))
                remote_client.modify_bat_file('/cygdrive/c/automation', bat_file,
                                               product, os_type, os_version, version, task)
                self.log.info('sleep for 5 seconds before running task schedule install me')
                time.sleep(5)
                # run task schedule to install Couchbase Server
                output, error = remote_client.execute_command("cmd /c schtasks /run /tn installme")
                remote_client.log_command_output(output, error)
                remote_client.wait_till_file_added(server_path, version_file, timeout_in_seconds=600)
                self.log.info('sleep 15 seconds before running the next job ...')
                time.sleep(15)
        else:
            self.log.error("Can not install Couchbase Server.")
开发者ID:jchris,项目名称:testrunner,代码行数:79,代码来源:install.py


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