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


Python RemoteHelper.install_couchbase方法代码示例

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


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

示例1: CouchbaseInstaller

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

    def __init__(self, cluster_spec, options):
        self.options = options
        self.remote = RemoteHelper(cluster_spec, None, options.verbose)
        self.cluster_spec = cluster_spec

        arch = self.remote.detect_arch()
        pkg = self.remote.detect_pkg()

        release = None
        build = None
        if options.version:
            release, build = options.version.split('-')

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

    def get_expected_filenames(self):
        if self.build.pkg == 'rpm':
            os_release = self.remote.detect_os_release()
            patterns = (
                'couchbase-server-{{edition}}-{{version}}-centos{}.{{arch}}.{{pkg}}'.format(os_release),
                'couchbase-server-{edition}_centos6_{arch}_{version}-rel.{pkg}',
            )
        elif self.build.pkg == 'deb':
            patterns = (
                'couchbase-server-{edition}_{arch}_{version}-rel.{pkg}',
                'couchbase-server-{edition}_{version}-ubuntu12.04_{arch}.{pkg}',
            )
        elif self.build.pkg == 'exe':
            patterns = (
                'couchbase-server-{edition}_{arch}_{version}-rel.setup.{pkg}',
                'couchbase-server-{edition}_{version}-windows_{arch}.{pkg}',
                'couchbase_server-{edition}-windows-{arch}-{version}.{pkg}',
            )
        else:
            patterns = ()  # Sentinel

        for pattern in patterns:
            yield pattern.format(**self.build.__dict__)

    @staticmethod
    def is_exist(url):
        try:
            status_code = requests.head(url).status_code
        except ConnectionError:
            return False
        if status_code == 200:
            return True
        return False

    def find_package(self):
        for filename in self.get_expected_filenames():
            for location in LOCATIONS:
                url = '{}{}'.format(location.format(**self.build.__dict__),
                                    filename)
                if self.is_exist(url):
                    return filename, url
        logger.interrupt('Target build not found')

    def kill_processes(self):
        self.remote.kill_processes()

    def uninstall_package(self):
        self.remote.uninstall_couchbase(self.build.pkg)

    def clean_data(self):
        self.remote.clean_data()

    def install_package(self):
        if self.options.version:
            filename, url = self.find_package()
        else:
            url = self.options.url
            filename = urlparse(url).path.split('/')[-1]

        logger.info('Using this URL: {}'.format(url))
        self.remote.install_couchbase(self.build.pkg, url, filename,
                                      self.build.release)

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

示例2: CouchbaseInstaller

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

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

    def __init__(self, cluster_spec, options):
        self.options = options
        self.remote = RemoteHelper(cluster_spec, None, options.verbose)
        self.cluster_spec = cluster_spec

        arch = self.remote.detect_arch()
        pkg = self.remote.detect_pkg()

        release = None
        build = None
        if options.version:
            release, build = options.version.split('-')
            self.SHERLOCK_BUILDS = 'http://latestbuilds.hq.couchbase.com/couchbase-server/sherlock/{}/'.format(build)
            self.WATSON_BUILDS = 'http://172.23.120.24/builds/latestbuilds/couchbase-server/watson/{}/'.format(build)
            if options.toy:
                self.SHERLOCK_BUILDS = 'http://latestbuilds.hq.couchbase.com/couchbase-server/toy-{}/{}/'.format(options.toy, build)
        self.build = Build(arch, pkg, options.cluster_edition, options.version,
                           release, build, options.toy, options.url)
        logger.info('Target build info: {}'.format(self.build))

    def get_expected_filenames(self):
        patterns = ()  # Sentinel
        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_ubunt12-3.0.0-toy-{toy}-{arch}_{version}-toy.{pkg}',
                'couchbase-server-community_cent64-3.0.0-toy-{toy}-{arch}_{version}-toy.{pkg}',
                'couchbase-server-community_cent64-3.0.1-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}',
                # For toy builds >= Sherlock
                'couchbase-server-{edition}-{version}-centos6.{arch}.{pkg}',
                'couchbase-server-{edition}_{version}-ubuntu12.04_amd64.{pkg}',
            )
        elif self.build.pkg == 'rpm':
            patterns = (
                'couchbase-server-{edition}_centos6_{arch}_{version}-rel.{pkg}',
                'couchbase-server-{edition}-{version}-centos6.{arch}.{pkg}',
                'couchbase-server-{edition}_{arch}_{version}-rel.{pkg}',
                'couchbase-server-{edition}-{version}.{arch}.{pkg}',
            )
        elif self.build.pkg == 'deb':
            patterns = (
                'couchbase-server-{edition}_ubuntu_1204_{arch}_{version}-rel.{pkg}',
                'couchbase-server-{edition}_{version}-ubuntu12.04_amd64.{pkg}',
                'couchbase-server-{edition}_{arch}_{version}-rel.{pkg}',
                'couchbase-server-{edition}_{version}_amd64.{pkg}',
            )
        elif self.build.pkg == 'exe':
            patterns = (
                'couchbase-server-{edition}_{arch}_{version}-rel.setup.{pkg}',
                'couchbase_server-{edition}-windows-amd64-{version}.{pkg}',
                'couchbase-server-{edition}_{version}-windows_amd64.{pkg}',
                'couchbase_server/{release}/{build}/couchbase_server-{edition}-windows-amd64-{version}.exe',
                'couchbase-server-{edition}_{version}-windows_amd64.{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.SHERLOCK_BUILDS, self.WATSON_BUILDS, self.CBFS):
                url = '{}{}'.format(base, filename)
                try:
                    status_code = requests.head(url).status_code
                except 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.kill_processes()

    def uninstall_package(self):
        self.remote.uninstall_couchbase(self.build.pkg)

    def clean_data(self):
        self.remote.clean_data()

    def install_package(self):
        if not self.options.url:
            filename, url = self.find_package()
        else:
            url = self.options.url
            logger.info("Using this URL to install instead of searching amongst"
                        " the known locations: {}".format(url))
#.........这里部分代码省略.........
开发者ID:vmx,项目名称:perfrunner,代码行数:103,代码来源:install.py

示例3: CouchbaseInstaller

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

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

    def __init__(self, cluster_spec, options):
        self.remote = RemoteHelper(cluster_spec, None, options.verbose)
        self.cluster_spec = cluster_spec

        arch = self.remote.detect_arch()
        pkg = self.remote.detect_pkg()
        release, build = options.version.split('-')
        self.SHERLOCK_BUILDS = 'http://latestbuilds.hq.couchbase.com/couchbase-server/sherlock/{}/'.format(build)

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

    def get_expected_filenames(self):
        patterns = ()  # Sentinel
        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_cent64-3.0.0-toy-{toy}-{arch}_{version}-toy.{pkg}',
                'couchbase-server-community_cent64-3.0.1-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.pkg == 'rpm':
            patterns = (
                'couchbase-server-enterprise_centos6_{arch}_{version}-rel.{pkg}',
                'couchbase-server-enterprise-{version}-centos6.{arch}.{pkg}',
                'couchbase-server-enterprise_{arch}_{version}-rel.{pkg}',
            )
        elif self.build.pkg == 'deb':
            patterns = (
                'couchbase-server-enterprise_ubuntu_1204_{arch}_{version}-rel.{pkg}',
                'couchbase-server-enterprise_{version}-ubuntu12.04_amd64.{pkg}',
                'couchbase-server-enterprise_{arch}_{version}-rel.{pkg}',
            )
        elif self.build.pkg == 'exe':
            patterns = (
                'couchbase-server-enterprise_{arch}_{version}-rel.setup.{pkg}',
                'couchbase_server-enterprise-windows-amd64-{version}.{pkg}',
                'couchbase_server/{release}/{build}/couchbase_server-enterprise-windows-amd64-{version}.exe',
            )

        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.SHERLOCK_BUILDS, self.CBFS):
                url = '{}{}'.format(base, filename)
                try:
                    status_code = requests.head(url).status_code
                except 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.kill_processes()

    def uninstall_package(self):
        self.remote.uninstall_couchbase(self.build.pkg)

    def clean_data(self):
        self.remote.clean_data()

    def install_package(self):
        filename, url = self.find_package()
        self.remote.install_couchbase(self.build.pkg, url, filename,
                                      self.build.release)

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

示例4: __init__

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

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

    @property
    def url(self) -> str:
        if validators.url(self.options.version):
            return self.options.version
        else:
            return self.find_package(edition=self.options.edition)

    @property
    def release(self) -> str:
        return self.options.version.split('-')[0]

    @property
    def build(self) -> str:
        split = self.options.version.split('-')
        if len(split) > 1:
            return split[1]

    def find_package(self, edition: str) -> [str, str]:
        for url in self.url_iterator(edition):
            if self.is_exist(url):
                return url
        logger.interrupt('Target build not found')

    def url_iterator(self, edition: str) -> Iterator[str]:
        os_release = None
        if self.remote.package == 'rpm':
            os_release = self.remote.detect_centos_release()
        elif self.remote.package == 'deb':
            os_release = self.remote.detect_ubuntu_release()

        for pkg_pattern in PKG_PATTERNS[self.remote.package]:
            for loc_pattern in LOCATIONS:
                url = loc_pattern + pkg_pattern
                yield url.format(release=self.release, build=self.build,
                                 edition=edition, os=os_release)

    @staticmethod
    def is_exist(url):
        try:
            status_code = requests.head(url).status_code
        except ConnectionError:
            return False
        if status_code == 200:
            return True
        return False

    def download(self):
        """Download and save a copy of the specified package."""
        if self.remote.package == 'rpm':
            logger.info('Saving a local copy of {}'.format(self.url))
            with open('couchbase.rpm', 'wb') as fh:
                resp = requests.get(self.url)
                fh.write(resp.content)
        else:
            logger.interrupt('Unsupported package format')

    def kill_processes(self):
        self.remote.kill_processes()

    def uninstall_package(self):
        self.remote.uninstall_couchbase()

    def clean_data(self):
        self.remote.clean_data()

    def install_package(self):
        logger.info('Using this URL: {}'.format(self.url))
        self.remote.upload_iss_files(self.release)
        self.remote.install_couchbase(self.url)

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


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