本文整理汇总了Python中robottelo.vm.VirtualMachine.configure_rhel_repo方法的典型用法代码示例。如果您正苦于以下问题:Python VirtualMachine.configure_rhel_repo方法的具体用法?Python VirtualMachine.configure_rhel_repo怎么用?Python VirtualMachine.configure_rhel_repo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类robottelo.vm.VirtualMachine
的用法示例。
在下文中一共展示了VirtualMachine.configure_rhel_repo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RHAI
# 需要导入模块: from robottelo.vm import VirtualMachine [as 别名]
# 或者: from robottelo.vm.VirtualMachine import configure_rhel_repo [as 别名]
class RHAI(Base):
def view_registered_systems(self):
"""To view the number of registered systems"""
result = self.wait_until_element(
locators['insights.registered_systems']
).text
return result
def register_client_to_rhai(self, activation_key, org, rhel_distro):
self.vm = VirtualMachine(distro=rhel_distro)
self.vm.create()
# Download and Install ketello-ca rpm
self.vm.install_katello_cert()
self.vm.register_contenthost(activation_key, org)
# Red Hat Access Insights requires RHEL 6/7 repo and it is not
# possible to sync the repo during the tests, Adding repo file.
if rhel_distro == 'rhel67':
rhel_repo = conf.properties['clients.rhel6_repo']
if rhel_distro == 'rhel71':
rhel_repo = conf.properties['clients.rhel7_repo']
try:
if rhel_distro == 'rhel67':
insights_repo = conf.properties['insights.insights_el6repo']
if rhel_distro == 'rhel71':
insights_repo = conf.properties['insights.insights_el7repo']
except KeyError:
pass
self.logger.info('RHEL repo {0}'.format(rhel_repo))
self.logger.info('Insights client repo {0}'.format(insights_repo))
self.vm.configure_rhel_repo(rhel_repo)
self.vm.run('wget -O /etc/yum.repos.d/insights.repo {0}'.
format(insights_repo))
# Install redhat-access-insights package
package_name = 'redhat-access-insights'
result = self.vm.run('yum install -y {0}'.format(package_name))
if result.return_code != 0:
raise AccessInsightsError(
'Unable to install redhat-access-insights rpm'
)
# Verify if package is installed by query it
result = self.vm.run('rpm -qi {0}'.format(package_name))
self.logger.info('Insights client rpm version: {0}'.format(
result.stdout))
if result.return_code != 0:
raise AccessInsightsError(
'Unable to install redhat-access-insights rpm'
)
# Register client with Red Hat Access Insights
result = self.vm.run('redhat-access-insights --register')
if result.return_code != 0:
test_connection = self.vm.run(
'redhat-access-insights --test-connection')
if test_connection.return_code != 0:
raise AccessInsightsError(
'Unable to register client, --test-connection not '
'successful')
raise AccessInsightsError(
'Unable to register client to Access Insights through '
'Satellite')