本文整理汇总了Python中perfrunner.helpers.remote.RemoteHelper.detect_pkg方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteHelper.detect_pkg方法的具体用法?Python RemoteHelper.detect_pkg怎么用?Python RemoteHelper.detect_pkg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类perfrunner.helpers.remote.RemoteHelper
的用法示例。
在下文中一共展示了RemoteHelper.detect_pkg方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CouchbaseInstaller
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import detect_pkg [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()
示例2: CouchbaseInstaller
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import detect_pkg [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()
示例3: CouchbaseInstaller
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import detect_pkg [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))
#.........这里部分代码省略.........
示例4: GatewayInstaller
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import detect_pkg [as 别名]
class GatewayInstaller(object):
CBFS = 'http://cbfs-ext.hq.couchbase.com/builds/'
def __init__(self, cluster_spec, test_config, options):
self.remote_helper = RemoteHelper(cluster_spec)
self.cluster_spec = cluster_spec
self.test_config = test_config
self.pkg = self.remote_helper.detect_pkg()
self.version = options.version
def find_package(self):
filename = 'couchbase-sync-gateway_{}_x86_64.rpm'.format(self.version)
url = '{}{}'.format(self.CBFS, filename)
try:
status_code = requests.head(url).status_code
except requests.exceptions.ConnectionError:
pass
else:
if status_code == 200:
logger.info('Found "{}"'.format(url))
return filename, url
logger.interrupt('Target build not found - {}'.format(url))
def kill_processes_gw(self):
self.remote_helper.kill_processes_gw()
def kill_processes_gl(self):
self.remote_helper.kill_processes_gl()
def uninstall_package_gw(self):
filename, url = self.find_package()
self.remote_helper.uninstall_package_gw(self.pkg, filename)
def uninstall_package_gl(self):
self.remote_helper.uninstall_package_gl()
def install_package_gw(self):
filename, url = self.find_package()
self.remote_helper.install_package_gw(self.pkg, url, filename,
self.version)
def install_package_gl(self):
self.remote_helper.install_package_gl()
def start_sync_gateways(self):
with open('templates/gateway_config_template.json') as fh:
template = json.load(fh)
db_master = self.cluster_spec.yield_masters().next()
template['databases']['db']['server'] = "http://bucket-1:[email protected]{}/".format(db_master)
template['maxIncomingConnections'] = self.test_config.gateway_settings.conn_in
template['maxCouchbaseConnections'] = self.test_config.gateway_settings.conn_db
template['CompressResponses'] = self.test_config.gateway_settings.compression
with open('templates/gateway_config.json', 'w') as fh:
fh.write(pretty_dict(template))
self.remote_helper.start_sync_gateway()
def install(self):
num_gateways = len(self.cluster_spec.gateways)
num_gateloads = len(self.cluster_spec.gateloads)
if num_gateways != num_gateloads:
logger.interrupt(
'The cluster config file has different number of gateways({}) and gateloads({})'
.format(num_gateways, num_gateloads)
)
self.kill_processes_gw()
self.uninstall_package_gw()
self.install_package_gw()
self.start_sync_gateways()
self.kill_processes_gl()
self.uninstall_package_gl()
self.install_package_gl()
示例5: CouchbaseInstaller
# 需要导入模块: from perfrunner.helpers.remote import RemoteHelper [as 别名]
# 或者: from perfrunner.helpers.remote.RemoteHelper import detect_pkg [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()