Skip to content

Commit

Permalink
[RHCloud] Update configure_rhai_client registration (#16497)
Browse files Browse the repository at this point in the history
* Update configure_rhai_client registration

* Update name and usage
  • Loading branch information
ColeHiggins2 authored Oct 3, 2024
1 parent 9664b16 commit 73bc6a5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pytest_fixtures/component/rh_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def rhcloud_registered_hosts(
):
"""Fixture that registers content hosts to Satellite and Insights."""
for vm in mod_content_hosts:
vm.configure_rhai_client(
vm.configure_insights_client(
satellite=module_target_sat,
activation_key=rhcloud_activation_key,
org=rhcloud_manifest_org,
Expand All @@ -51,7 +51,7 @@ def rhel_insights_vm(
rhel_contenthost.configure_rex(
satellite=module_target_sat, org=rhcloud_manifest_org, register=False
)
rhel_contenthost.configure_rhai_client(
rhel_contenthost.configure_insights_client(
satellite=module_target_sat,
activation_key=rhcloud_activation_key,
org=rhcloud_manifest_org,
Expand Down
26 changes: 13 additions & 13 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ def configure_rex(self, satellite, org, subnet_id=None, by_ip=True, register=Tru
host.host_parameters_attributes = host_parameters
host.update(['host_parameters_attributes'])

def configure_rhai_client(
def configure_insights_client(
self, satellite, activation_key, org, rhel_distro, register_insights=True, register=True
):
"""Configures a Red Hat Access Insights service on the system by
Expand All @@ -1052,18 +1052,7 @@ def configure_rhai_client(
:param register: Whether to register client to insights
:return: None
"""
if register:
if not activation_key:
activation_key = satellite.api.ActivationKey(
content_view=org.default_content_view.id,
environment=org.library.id,
organization=org,
).create()
self.register(
org, None, activation_key.name, satellite, setup_insights=register_insights
)

# Red Hat Insights requires RHEL 6/7/8 repo and it is not
# Red Hat Insights requires RHEL 6/7/8/9 repo and it is not
# possible to sync the repo during the tests, Adding repo file.
distro_repo_map = {
'rhel6': settings.repos.rhel6_os,
Expand All @@ -1084,6 +1073,17 @@ def configure_rhai_client(
# Ensure insights-client rpm is installed
if self.execute('yum install -y insights-client').status != 0:
raise ContentHostError('Unable to install insights-client rpm')
# attempt to register host
if register:
if not activation_key:
activation_key = satellite.api.ActivationKey(
content_view=org.default_content_view.id,
environment=org.library.id,
organization=org,
).create()
self.register(
org, None, activation_key.name, satellite, setup_insights=register_insights
)

def unregister_insights(self):
"""Unregister insights client.
Expand Down
2 changes: 1 addition & 1 deletion tests/foreman/cli/test_http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_insights_client_registration_with_http_proxy(
:customerscenario: true
"""
rhel_contenthost.configure_rhai_client(
rhel_contenthost.configure_insights_client(
module_target_sat,
rhcloud_activation_key,
rhcloud_manifest_org,
Expand Down

0 comments on commit 73bc6a5

Please sign in to comment.