Skip to content

Commit

Permalink
Hosts: use global registration for Cockipt host
Browse files Browse the repository at this point in the history
Use global registration for `contenthosts::cockpit_host` fixture.

Also a minor logging message improvement.
  • Loading branch information
pnovotny committed Sep 8, 2023
1 parent ae8d78e commit dd08b2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions pytest_fixtures/core/contenthosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,20 @@ def katello_host_tools_host(target_sat, module_org, rhel_contenthost):


@pytest.fixture
def cockpit_host(class_target_sat, class_org, rhel_contenthost):
def cockpit_host(class_target_sat, class_org, rhel_contenthost, module_ak_with_cv):
"""Register content host to Satellite and install cockpit on the host."""
rhelver = rhel_contenthost.os_version.major
if rhelver > 7:
repo = [settings.repos[f'rhel{rhelver}_os']['baseos']]
else:
repo = [settings.repos['rhel7_os'], settings.repos['rhel7_extras']]
class_target_sat.register_host_custom_repo(class_org, rhel_contenthost, repo)
rhel_contenthost.register(
org=class_org,
loc=None,
activation_keys=module_ak_with_cv.name,
target=class_target_sat,
repo=repo,
)
rhel_contenthost.execute(f"hostnamectl set-hostname {rhel_contenthost.hostname} --static")
rhel_contenthost.install_cockpit()
rhel_contenthost.add_rex_key(satellite=class_target_sat)
Expand Down
2 changes: 1 addition & 1 deletion robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ def install_cockpit(self):
"""
result = self.execute('yum install cockpit -y')
if result.status != 0:
raise ContentHostError('Failed to install the cockpit')
raise ContentHostError(f'Failed to install the cockpit: {result.stderr}')

def register(
self,
Expand Down

0 comments on commit dd08b2e

Please sign in to comment.