Skip to content

Update iop for foremanctl - #22066

Open
ColeHiggins2 wants to merge 4 commits into
SatelliteQE:masterfrom
ColeHiggins2:update-iop-for-foremanctl
Open

Update iop for foremanctl#22066
ColeHiggins2 wants to merge 4 commits into
SatelliteQE:masterfrom
ColeHiggins2:update-iop-for-foremanctl

Conversation

@ColeHiggins2

@ColeHiggins2 ColeHiggins2 commented Jul 6, 2026

Copy link
Copy Markdown
Member

IOP is currently enabled using satellite-installer. We need functionality for both satellite-installer and foremanctl.

Tests are failing with:
"requests.exceptions.HTTPError: 404 Client Error: Not Found for url:Satellite.com/api/v2/rh_cloud/advisor_engine_config

Updated methods to look at Installment type and set up iop accordingly.

Summary by Sourcery

Support IoP enable/disable flows for both satellite-installer and foremanctl based deployments while adjusting IoP status detection.

New Features:

  • Add foremanctl-based IoP deployment and removal paths alongside existing satellite-installer flows.

Enhancements:

  • Branch IoP configuration logic and related helper methods on install method to use appropriate tooling.
  • Skip satellite-installer-specific IoP log level tests when running against foremanctl-based installations.

Tests:

  • Extend IoP CLI tests to cover foremanctl deployments for enabling, disabling, and re-enabling IoP.
  • Update IoP status checks in hosts to work with foremanctl feature listing instead of the previous API endpoint.

@ColeHiggins2 ColeHiggins2 self-assigned this Jul 6, 2026
@ColeHiggins2
ColeHiggins2 requested review from a team as code owners July 6, 2026 21:06
@ColeHiggins2 ColeHiggins2 added Tier 2 ACK A Tier 2 reviewer has ACK'd this PR No-CherryPick PR doesnt need CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master labels Jul 6, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This PR adds foremanctl-based IoP (local Red Hat Lightspeed) management alongside the existing satellite-installer flow, branching behavior on the host install method and updating tests and helpers to use the appropriate mechanism and detection logic.

Sequence diagram for IoP configuration branching by install_method

sequenceDiagram
    participant Host
    participant CDN
    participant ForemanctlCLI
    participant SatelliteInstallerCLI

    Host->>CDN: register_to_cdn()
    Host->>Host: enable_ipv6_podman_proxy()
    alt install_method == FOREMANCTL
        Host->>ForemanctlCLI: execute('foremanctl deploy --add-feature iop')
    else installer
        Host->>Host: get_iop_image_paths()
        alt image_paths returned
            Host->>Host: yaml.dump(image_paths)
            Host->>Host: put(custom_hiera, /etc/foreman-installer/custom-hiera.yaml)
        end
        Host->>SatelliteInstallerCLI: execute(InstallerCommand('enable-iop', iop_ensure='present').get_command())
    end
    Host->>Host: iop_enabled
    Note right of Host: Raises SatelliteHostError if result.status != 0 or iop_enabled is False
Loading

Sequence diagram for IoP enabled detection based on install_method

sequenceDiagram
    participant Host
    participant ForemanctlCLI
    participant Shell

    Host->>Host: iop_enabled
    alt install_method == FOREMANCTL
        Host->>ForemanctlCLI: list_foremanctl_features(enabled=True)
        ForemanctlCLI-->>Host: features
        Host->>Host: check 'iop' in features
    else installer
        Host->>Shell: execute('systemctl is-active iop-core-engine')
        Shell-->>Host: result.status
        Host->>Host: result.status == 0
    end
Loading

File-Level Changes

Change Details Files
Add install-method branching so IoP can be configured and toggled via foremanctl as well as satellite-installer.
  • Import InstallMethod enum into test and helper modules.
  • In IoP setup and enable/disable tests, branch on satellite.install_method to either run foremanctl deploy commands or the previous InstallerCommand-based satellite-installer invocations.
  • Update SatelliteHostMixin.configure_iop to use foremanctl deploy --add-feature iop when install_method is FOREMANCTL and retain installer-based configuration otherwise, including image-path hiera generation.
  • Update SatelliteHostMixin.uninstall_iop to use foremanctl deploy --remove-feature iop when appropriate.
tests/foreman/cli/test_rhcloud_iop.py
robottelo/host_helpers/satellite_mixins.py
Change IoP enabled-state detection logic to work on foremanctl-based deployments and avoid the failing API call.
  • Replace RHCloud.advisor_engine_config() API-based IoP detection in Host.iop_enabled with logic that, for foremanctl installs, checks enabled foremanctl features for 'iop'.
  • For installer-based installs, check the iop-core-engine systemd service activity instead of the removed API endpoint.
robottelo/hosts.py
Skip installer-specific IoP log-level test on foremanctl installs where the functionality is not available.
  • Add an install_method check in test_set_iop_log_level_via_installer that calls pytest.skip when the module satellite IoP host uses FOREMANCTL.
tests/foreman/cli/test_rhcloud_iop.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ColeHiggins2

Copy link
Copy Markdown
Member Author

PRT is currently failing with issues around the satellite rex keys. Not related to these code changes

@sourcery-ai sourcery-ai Bot left a comment

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.

Hey - I've left some high level feedback:

  • In Host.iop_enabled, consider preserving the existing API-based check for non-foremanctl installs and only falling back to systemctl is-active when the API endpoint is unavailable, to avoid changing semantics for satellite-installer setups.
  • The foremanctl branch in test_positive_install_iop_custom_certs omits use of certs_server_ca_cert that was previously passed via satellite-installer; verify whether an equivalent CA bundle option is needed for foremanctl deploy and wire it through if so.
  • You now import InstallMethod in multiple places (module-level and inside iop_enabled); centralizing this import at module level and reusing it would simplify the code and avoid repeated imports.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `Host.iop_enabled`, consider preserving the existing API-based check for non-foremanctl installs and only falling back to `systemctl is-active` when the API endpoint is unavailable, to avoid changing semantics for satellite-installer setups.
- The foremanctl branch in `test_positive_install_iop_custom_certs` omits use of `certs_server_ca_cert` that was previously passed via `satellite-installer`; verify whether an equivalent CA bundle option is needed for `foremanctl deploy` and wire it through if so.
- You now import `InstallMethod` in multiple places (module-level and inside `iop_enabled`); centralizing this import at module level and reusing it would simplify the code and avoid repeated imports.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread robottelo/host_helpers/satellite_mixins.py Outdated
Comment on lines +482 to +484
result = self.execute('foremanctl deploy --add-feature iop', timeout='30m')
else:
# Set up container image path overrides for satellite-installer

@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

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.

+1, I have the same concern about where foremanctl image overrides are handled in this path.

Comment thread robottelo/hosts.py Outdated
Comment thread robottelo/hosts.py
@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

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.

That's great! Could you do this cleanup in nailgun entities as well whenever you get a chance?

Comment thread tests/foreman/cli/test_rhcloud_iop.py Outdated
@Gauravtalreja1 Gauravtalreja1 removed the Tier 2 ACK A Tier 2 reviewer has ACK'd this PR label Jul 7, 2026
Comment on lines +482 to +484
result = self.execute('foremanctl deploy --add-feature iop', timeout='30m')
else:
# Set up container image path overrides for satellite-installer

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.

+1, I have the same concern about where foremanctl image overrides are handled in this path.

Comment thread tests/foreman/cli/test_rhcloud_iop.py Outdated
Comment on lines +120 to +122
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"]}',

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.

This foremanctl custom-certs path is missing the CA bundle flag. We pass server cert/key here, but not the foremanctl equivalent of certs_server_ca_cert. In tests/foreman/installer/test_install_foremanctl.py we include --certificate-server-ca-certificate ... for custom cert installs. Can we add that here too (likely /root/{certs_data["ca_bundle_file_name"]}) so this test validates the full custom-CA flow?

@ColeHiggins2
ColeHiggins2 force-pushed the update-iop-for-foremanctl branch from 325318e to de25fb9 Compare July 15, 2026 13:36
@ColeHiggins2

Copy link
Copy Markdown
Member Author
trigger: test-robottelo
pytest: tests/foreman/cli/test_rhcloud_iop.py::test_disable_enable_iop tests/foreman/cli/test_rhcloud_iop.py::test_positive_install_iop_custom_certs
env:
    ROBOTTELO_server__deploy_arguments__deploy_container: true

@Satellite-QE

Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 16143
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/cli/test_rhcloud_iop.py::test_disable_enable_iop tests/foreman/cli/test_rhcloud_iop.py::test_positive_install_iop_custom_certs --external-logging
Test Result : ================= 24 warnings, 2 errors in 5000.11s (1:23:20) ==================

@Satellite-QE Satellite-QE added the PRT-Failed Indicates that latest PRT run is failed for the PR label Jul 16, 2026
f,
sort_keys=False,
default_flow_style=False,
if self.install_method == InstallMethod.FOREMANCTL:

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.

Jfyi, since today we use same templates for both scenario, install_method() has underlying detect_install_method() which would pass for both scenarios, so I'd suggest using settings.server.install_method instead

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.

What if there will be migration test:
SAT1 (rpm) -> SAT2 (containerized)

Then using static setting you won't be able to handle that.

@Gauravtalreja1

Copy link
Copy Markdown
Member

@ColeHiggins2 Just a heads up, you can use deployment_type: container in the PRT comment instead of manually passing the env var. There are a few additional changes needed beyond just the setting override, and the deployment_type flag already handles all of them.
For ref: https://github.com/SatelliteQE/robottelo/wiki/Robottelo-Pull-Request-Testing-(PRT)-Process#example-12-running-tests-in-containerized-environment

@ColeHiggins2

Copy link
Copy Markdown
Member Author
trigger: test-robottelo
pytest: tests/foreman/cli/test_rhcloud_iop.py::test_disable_enable_iop tests/foreman/cli/test_rhcloud_iop.py::test_positive_install_iop_custom_certs
deployment_type: container

@Satellite-QE

Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 16156
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/cli/test_rhcloud_iop.py::test_disable_enable_iop tests/foreman/cli/test_rhcloud_iop.py::test_positive_install_iop_custom_certs --external-logging
Test Result : ================= 24 warnings, 2 errors in 5338.07s (1:28:58) ==================

@ColeHiggins2

Copy link
Copy Markdown
Member Author
trigger: test-robottelo
pytest: tests/foreman/cli/test_rhcloud_iop.py::test_disable_enable_iop tests/foreman/cli/test_rhcloud_iop.py::test_positive_install_iop_custom_certs
env:
    ROBOTTELO_server__deploy_arguments__deploy_container: true
    ROBOTTELO_server__version__release: 'stream'
    ROBOTTELO_server__version__snap: '199.0'
    ROBOTTELO_server__deploy_arguments__deploy_sat_version: 'stream'
    ROBOTTELO_server__deploy_arguments__deploy_snap_version: '199.0'

@Satellite-QE

Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 16188
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/cli/test_rhcloud_iop.py::test_disable_enable_iop tests/foreman/cli/test_rhcloud_iop.py::test_positive_install_iop_custom_certs --external-logging
Test Result : ============= 1 failed, 18 warnings, 1 error in 2731.54s (0:45:31) =============

@ColeHiggins2

Copy link
Copy Markdown
Member Author
trigger: test-robottelo
pytest: tests/foreman/cli/test_rhcloud_iop.py::test_disable_enable_iop tests/foreman/cli/test_rhcloud_iop.py::test_positive_install_iop_custom_certs
env:
    ROBOTTELO_server__deploy_arguments__deploy_container: true
    ROBOTTELO_server__version__release: 'stream'
    ROBOTTELO_server__version__snap: '199.0'
    ROBOTTELO_server__deploy_arguments__deploy_sat_version: 'stream'
    ROBOTTELO_server__deploy_arguments__deploy_snap_version: '199.0'

@Satellite-QE

Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 16191
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/cli/test_rhcloud_iop.py::test_disable_enable_iop tests/foreman/cli/test_rhcloud_iop.py::test_positive_install_iop_custom_certs --external-logging
Test Result : ============= 1 failed, 18 warnings, 1 error in 2486.63s (0:41:26) =============

@chris1984 chris1984 left a comment

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.

Went through the changes and it looks pretty good.

@Gauravtalreja1

Copy link
Copy Markdown
Member
trigger: test-robottelo
pytest: tests/foreman/cli/test_rhcloud_iop.py::test_disable_enable_iop tests/foreman/cli/test_rhcloud_iop.py::test_positive_install_iop_custom_certs
deployment_type: container

@Satellite-QE

Copy link
Copy Markdown
Collaborator

PRT Result

Build Number: 16210
Build Status: UNSTABLE
PRT Comment: pytest tests/foreman/cli/test_rhcloud_iop.py::test_disable_enable_iop tests/foreman/cli/test_rhcloud_iop.py::test_positive_install_iop_custom_certs --external-logging
Test Result : ================= 2 failed, 18 warnings in 2934.10s (0:48:54) ==================

@ekohl ekohl left a comment

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.

For reference, we use systemd drop-ins to manage the images. https://github.com/theforeman/foremanctl/blob/master/docs/developer/deployment.md#image-management describes that. From that I'd expect that in robottelo everything is already set and no explicit image management should be needed in a containerized installation.

Comment thread robottelo/hosts.py
return self.api.RHCloud().advisor_engine_config()['use_iop_mode']

if self.install_method == InstallMethod.FOREMANCTL:
return 'iop' in self.list_foremanctl_features(enabled=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.

Wouldn't it be better to probe the real system and find a Smart Proxy with the iop feature? That works for both installation methods and doesn't require running any shell commands on the real system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do Not Merge No-CherryPick PR doesnt need CherryPick to previous branches PRT-Failed Indicates that latest PRT run is failed for the PR Stream Introduced in or relating directly to Satellite Stream/Master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants