Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 36 additions & 28 deletions robottelo/host_helpers/satellite_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
PUPPET_COMMON_INSTALLER_OPTS,
PUPPET_SATELLITE_INSTALLER,
)
from robottelo.enums import NetworkType
from robottelo.enums import InstallMethod, NetworkType
from robottelo.exceptions import CLIReturnCodeError, NoManifestProvidedError, SatelliteHostError
from robottelo.host_helpers.api_factory import APIFactory
from robottelo.host_helpers.cli_factory import CLIFactory
Expand Down Expand Up @@ -457,7 +457,11 @@ def get_iop_image_paths():
}

def configure_iop(self):
"""Configure on prem Advisor engine on Satellite"""
"""Configure on prem Advisor engine on Satellite.

Branches on install_method: foremanctl uses ``foremanctl deploy --add-feature iop``,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to say "Based on install_method..."?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I can change this

installer uses ``satellite-installer --enable-iop --iop-ensure present``.
"""
logger.info('Configuring Satellite with local Red Hat Lightspeed')

self.register_to_cdn()
Expand All @@ -472,30 +476,33 @@ def configure_iop(self):
iop_settings.stage_username, iop_settings.stage_token, iop_settings.stage_registry
)

# Set IPv6 podman proxy on Satellite, to pull from container registry
self.enable_ipv6_podman_proxy()

# Set up container image path overrides
if image_paths := self.get_iop_image_paths():
custom_hiera = f'{robottelo_tmp_dir}/custom-hiera.yaml'

with open(custom_hiera, 'w') as f:
yaml.dump(
image_paths,
f,
sort_keys=False,
default_flow_style=False,
)
self.put(custom_hiera, '/etc/foreman-installer/custom-hiera.yaml')

command = InstallerCommand(
'enable-iop',
iop_ensure='present',
scenario='satellite',
foreman_initial_admin_password=settings.server.admin_password,
).get_command()

result = self.execute(command, timeout='30m')
if self.install_method == InstallMethod.FOREMANCTL:
result = self.execute('foremanctl deploy --add-feature iop', timeout='30m')
else:
# Set up container image path overrides for satellite-installer
Comment on lines +482 to +484

@Gauravtalreja1 Gauravtalreja1 Jul 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How and where do you override the image paths for foremanctl to deploy IOP containers, as similar to traditional installer's custom hiera?

@ColeHiggins2 ColeHiggins2 Jul 6, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasnt aware that we need to override the image paths for foremanctl. If that is necessary, I can add it in

if image_paths := self.get_iop_image_paths():
custom_hiera = f'{robottelo_tmp_dir}/custom-hiera.yaml'

with open(custom_hiera, 'w') as f:
yaml.dump(
image_paths,
f,
sort_keys=False,
default_flow_style=False,
)
self.put(custom_hiera, '/etc/foreman-installer/custom-hiera.yaml')

command = InstallerCommand(
'enable-iop',
iop_ensure='present',
scenario='satellite',
foreman_initial_admin_password=settings.server.admin_password,
).get_command()

result = self.execute(command, timeout='30m')

if result.status != 0:
raise SatelliteHostError(f'Failed to configure IoP: {result.stdout}')
if not self.iop_enabled:
Expand All @@ -506,11 +513,12 @@ def uninstall_iop(self):
logger.info('IoP is already disabled. Skipping uninstallation.')
return

command = InstallerCommand(
iop_ensure='absent',
).get_command()
if self.install_method == InstallMethod.FOREMANCTL:
result = self.execute('foremanctl deploy --remove-feature iop', timeout='30m')
else:
command = InstallerCommand(iop_ensure='absent').get_command()
result = self.execute(command, timeout='30m')

result = self.execute(command, timeout='30m')
if result.status != 0:
raise SatelliteHostError(f'Failed to disable IoP: {result.stdout}')
if self.iop_enabled:
Expand Down
7 changes: 6 additions & 1 deletion robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3145,7 +3145,12 @@ def set_pulp_cli_safemode(self, safe):
@property
def iop_enabled(self):
"""Return boolean indicating whether IoP (local Red Hat Lightspeed) is enabled."""
return self.api.RHCloud().advisor_engine_config()['use_iop_mode']

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, Is this API not available on foremanctl deployment? or am I missing some update around this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct this endpoint should have been removed and it open here theforeman/foreman_rh_cloud#1226

from robottelo.enums import InstallMethod

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have this import at module/file level, instead of keeping for each property?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look into this yes


if self.install_method == InstallMethod.FOREMANCTL:
return 'iop' in self.list_foremanctl_features(enabled=True)
result = self.execute('systemctl is-active iop-core-engine')
return result.status == 0


class SSOHost(Host):
Expand Down
65 changes: 43 additions & 22 deletions tests/foreman/cli/test_rhcloud_iop.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import yaml

from robottelo.config import settings
from robottelo.enums import InstallMethod
from robottelo.utils.installer import InstallerCommand

IOP_SERVICES = [
Expand Down Expand Up @@ -113,24 +114,33 @@ def test_positive_install_iop_custom_certs(
)
assert result.status == 0, f'Error logging in to container registry: {result.stdout}'

# Set up container image path overrides
custom_hiera_yaml = yaml.dump(
{f'iop::{service}::image': path for service, path in iop_settings.image_paths.items()}
)
satellite.execute(f'echo "{custom_hiera_yaml}" > /etc/foreman-installer/custom-hiera.yaml')

command = InstallerCommand(
'enable-iop',
'certs-update-server',
'certs-update-server-ca',
scenario='satellite',
certs_server_cert=f'/root/{certs_data["cert_file_name"]}',
certs_server_key=f'/root/{certs_data["key_file_name"]}',
certs_server_ca_cert=f'/root/{certs_data["ca_bundle_file_name"]}',
foreman_initial_admin_password=settings.server.admin_password,
).get_command()

result = satellite.execute(command, timeout='30m')
if satellite.install_method == InstallMethod.FOREMANCTL:
result = satellite.execute(
'foremanctl deploy --add-feature iop'
f' --certificate-source=custom_server'
f' --certificate-server-certificate /root/{certs_data["cert_file_name"]}'
f' --certificate-server-key /root/{certs_data["key_file_name"]}',
timeout='30m',
)
else:
# Set up container image path overrides
custom_hiera_yaml = yaml.dump(
{f'iop::{service}::image': path for service, path in iop_settings.image_paths.items()}
)
satellite.execute(f'echo "{custom_hiera_yaml}" > /etc/foreman-installer/custom-hiera.yaml')

command = InstallerCommand(
'enable-iop',
'certs-update-server',
'certs-update-server-ca',
scenario='satellite',
certs_server_cert=f'/root/{certs_data["cert_file_name"]}',
certs_server_key=f'/root/{certs_data["key_file_name"]}',
certs_server_ca_cert=f'/root/{certs_data["ca_bundle_file_name"]}',
foreman_initial_admin_password=settings.server.admin_password,
).get_command()

result = satellite.execute(command, timeout='30m')
assert result.status == 0

result = satellite.execute('hammer ping')
Expand Down Expand Up @@ -222,8 +232,11 @@ def test_disable_enable_iop(module_satellite_iop, module_sca_manifest, rhel_cont
assert result.status == 0, 'Initial insights-client upload failed'

# Disable IoP
command = InstallerCommand(iop_ensure='absent').get_command()
result = satellite.execute(command, timeout='10m')
if satellite.install_method == InstallMethod.FOREMANCTL:
result = satellite.execute('foremanctl deploy --remove-feature iop', timeout='30m')
else:
command = InstallerCommand(iop_ensure='absent').get_command()
result = satellite.execute(command, timeout='10m')
assert result.status == 0, 'Failed to disable IoP'

result = satellite.execute('satellite-maintain service restart')
Expand Down Expand Up @@ -260,8 +273,11 @@ def test_disable_enable_iop(module_satellite_iop, module_sca_manifest, rhel_cont
assert result.status == 0, 'Failed to unregister from Red Hat Lightspeed'

# Re-enable IoP
command = InstallerCommand(iop_ensure='present').get_command()
result = satellite.execute(command, timeout='10m')
if satellite.install_method == InstallMethod.FOREMANCTL:
result = satellite.execute('foremanctl deploy --add-feature iop', timeout='30m')
else:
command = InstallerCommand(iop_ensure='present').get_command()
result = satellite.execute(command, timeout='10m')
assert result.status == 0, 'Failed to re-enable IoP'

result = satellite.execute('satellite-maintain service restart')
Expand Down Expand Up @@ -369,6 +385,11 @@ def test_set_iop_log_level_via_installer(module_satellite_iop):

:Verifies: SAT-41750
"""
if module_satellite_iop.install_method == InstallMethod.FOREMANCTL:
pytest.skip(
'IoP log level configuration via satellite-installer not available on foremanctl'
)

Comment on lines +388 to +392

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fyi, after #22007, we can mark this test with @pytest.mark.foreman_installer so it gets skipped on foremanctl

NEW_LOG_LEVEL = 'DEBUG'

# Retrieve the IoP log level settings from satellite-installer help output
Expand Down
Loading