Skip to content

Update iop for foremanctl#22066

Open
ColeHiggins2 wants to merge 1 commit into
SatelliteQE:masterfrom
ColeHiggins2:update-iop-for-foremanctl
Open

Update iop for foremanctl#22066
ColeHiggins2 wants to merge 1 commit 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.

"""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

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

Comment thread robottelo/hosts.py
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']
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

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

Comment on lines +388 to +392
if module_satellite_iop.install_method == InstallMethod.FOREMANCTL:
pytest.skip(
'IoP log level configuration via satellite-installer not available on 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.

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

@Gauravtalreja1 Gauravtalreja1 removed the Tier 2 ACK A Tier 2 reviewer has ACK'd this PR label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No-CherryPick PR doesnt need CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants