Skip to content
Merged
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
2 changes: 1 addition & 1 deletion conf/rh_cloud.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RH_CLOUD:
ORGANIZATION:
ACTIVATION_KEY: ak_name
CRC_ENV: prod
IOP_ADVISOR_ENGINE:
IOP:
IMAGE_PATH: # For 6.17 IoP
IMAGE_PATHS: # For 6.18+ IoP
REGISTRY:
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/maintain.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def sat_maintain(request):
yield infra_host

if host_type == 'satellite_iop':
iop_settings = settings.rh_cloud.iop_advisor_engine
iop_settings = settings.rh_cloud.iop
if not infra_host.is_podman_logged_in(iop_settings.stage_registry):
infra_host.podman_login(
iop_settings.stage_username,
Expand Down
3 changes: 1 addition & 2 deletions pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ def module_unconfigured_satellite():
def get_iop_deploy_args():
"""Get deploy arguments for IoP workflow"""
image_args = {
f'iop_{service}_image': path
for service, path in settings.rh_cloud.iop_advisor_engine.image_paths.items()
f'iop_{service}_image': path for service, path in settings.rh_cloud.iop.image_paths.items()
}
return settings.server.deploy_arguments.to_dict() | image_args

Expand Down
4 changes: 1 addition & 3 deletions robottelo/config/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,7 @@
],
rh_cloud=[
Validator('rh_cloud.token', required=True),
Validator(
'rh_cloud.iop_advisor_engine.image_paths', default={}, apply_default_on_none=True
),
Validator('rh_cloud.iop.image_paths', default={}, apply_default_on_none=True),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): Consider backward compatibility with existing rh_cloud.iop_advisor_engine.image_paths configs.

By switching validation to rh_cloud.iop.image_paths, deployments that still set rh_cloud.iop_advisor_engine.image_paths will now get the default {} and leave iop.image_paths unset, potentially changing behavior without any explicit signal. To avoid silent misconfigurations, consider either reading from both keys (preferring iop.image_paths) or failing fast when the old key is set but the new one is not.

],
repos=[
Validator(
Expand Down
4 changes: 2 additions & 2 deletions robottelo/host_helpers/satellite_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ class IoPSetup:
def get_iop_image_paths():
return {
f'iop::{service}::image': path
for service, path in settings.rh_cloud.iop_advisor_engine.image_paths.items()
for service, path in settings.rh_cloud.iop.image_paths.items()
}

def configure_iop(self):
Expand All @@ -466,7 +466,7 @@ def configure_iop(self):

self.ensure_podman_installed()

iop_settings = settings.rh_cloud.iop_advisor_engine
iop_settings = settings.rh_cloud.iop
self.podman_login(iop_settings.username, iop_settings.token, iop_settings.registry)
self.podman_login(
iop_settings.stage_username, iop_settings.stage_token, iop_settings.stage_registry
Expand Down
6 changes: 3 additions & 3 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,7 @@ def ensure_podman_installed(self):

def podman_login(self, username=None, password=None, registry=None):
"""Login to a podman registry."""
iop_settings = settings.rh_cloud.iop_advisor_engine
iop_settings = settings.rh_cloud.iop
username = username or iop_settings.username
password = password or iop_settings.token
registry = registry or iop_settings.registry
Expand Down Expand Up @@ -1652,7 +1652,7 @@ def podman_login(self, username=None, password=None, registry=None):

def is_podman_logged_in(self, registry=None):
"""Check if podman is logged into a registry."""
registry = registry or settings.rh_cloud.iop_advisor_engine.registry
registry = registry or settings.rh_cloud.iop.registry
return (
self.execute(
f'podman login --get-login --authfile {constants.PODMAN_AUTHFILE_PATH} {registry}'
Expand All @@ -1663,7 +1663,7 @@ def is_podman_logged_in(self, registry=None):

def podman_logout(self, registry=None):
"""Logout of a podman registry."""
registry = registry or settings.rh_cloud.iop_advisor_engine.registry
registry = registry or settings.rh_cloud.iop.registry
if self.is_podman_logged_in(registry):
cmd_result = self.execute(
f'podman logout --authfile {constants.PODMAN_AUTHFILE_PATH} {registry}'
Expand Down
2 changes: 1 addition & 1 deletion tests/foreman/cli/test_rhcloud_iop.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_positive_install_iop_custom_certs(
"""
satellite = sat_ready_rhel
host = rhel_contenthost
iop_settings = settings.rh_cloud.iop_advisor_engine
iop_settings = settings.rh_cloud.iop

# Satellite + IoP installation

Expand Down
2 changes: 1 addition & 1 deletion tests/foreman/maintain/test_health.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_podman_login_check(request, sat_maintain):

:Verifies: SAT-35282
"""
iop_settings = settings.rh_cloud.iop_advisor_engine
iop_settings = settings.rh_cloud.iop

request.addfinalizer(lambda: sat_maintain.podman_logout(iop_settings.registry))

Expand Down