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


Python RemoteHelper.detect_openssl方法代码示例

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


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

示例1: CouchbaseInstaller

# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import detect_openssl [as 别名]
class CouchbaseInstaller(object):

    CBFS = 'http://cbfs-ext.hq.couchbase.com/builds/'
    LATEST_BUILDS = 'http://builds.hq.northscale.net/latestbuilds/'

    def __init__(self, cluster_spec, options):
        self.remote_helper = RemoteHelper(cluster_spec)
        self.cluster_spec = cluster_spec

        arch = self.remote_helper.detect_arch()
        pkg = self.remote_helper.detect_pkg()
        openssl = self.remote_helper.detect_openssl(pkg)

        self.build = Build(arch, pkg, options.version, openssl, options.toy)
        logger.info('Target build info: {}'.format(self.build))

    def get_expected_filenames(self):
        if self.build.toy:
            patterns = (
                'couchbase-server-community_toy-{toy}-{arch}_{version}-toy.{pkg}',
                'couchbase-server-community_toy-{toy}-{version}-toy_{arch}.{pkg}',
                'couchbase-server-community_cent58-2.5.2-toy-{toy}-{arch}_{version}-toy.{pkg}',
                'couchbase-server-community_cent58-3.0.0-toy-{toy}-{arch}_{version}-toy.{pkg}',
                'couchbase-server-community_cent58-master-toy-{toy}-{arch}_{version}-toy.{pkg}',
                'couchbase-server-community_cent54-master-toy-{toy}-{arch}_{version}-toy.{pkg}',
            )
        elif self.build.openssl == '0.9.8e':
            patterns = (
                'couchbase-server-enterprise_{arch}_{version}-rel.{pkg}',
                'couchbase-server-enterprise_{version}-rel_{arch}_openssl098.{pkg}',
            )
        else:
            patterns = (
                'couchbase-server-enterprise_centos6_{arch}_{version}-rel.{pkg}',
                'couchbase-server-enterprise_{arch}_{version}-rel.{pkg}',
                'couchbase-server-enterprise_{version}-rel_{arch}.{pkg}',
            )
        for pattern in patterns:
            yield pattern.format(**self.build._asdict())

    def find_package(self):
        for filename in self.get_expected_filenames():
            for base in (self.LATEST_BUILDS, self.CBFS):
                url = '{}{}'.format(base, filename)
                try:
                    status_code = requests.head(url).status_code
                except requests.exceptions.ConnectionError:
                    continue
                else:
                    if status_code == 200:
                        logger.info('Found "{}"'.format(url))
                        return filename, url
        logger.interrupt('Target build not found')

    def kill_processes(self):
        self.remote_helper.kill_processes()

    def uninstall_package(self):
        self.remote_helper.uninstall_package(self.build.pkg)

    def clean_data(self):
        self.remote_helper.clean_data()

    def install_package(self):
        filename, url = self.find_package()
        version = self.build.version.split('-')[0]
        self.remote_helper.install_package(self.build.pkg, url, filename,
                                           version)

    def install(self):
        self.kill_processes()
        self.uninstall_package()
        self.clean_data()
        self.install_package()
开发者ID:lichenyang2,项目名称:perfrunner,代码行数:76,代码来源:install.py


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