Update iop for foremanctl#22066
Conversation
Reviewer's GuideThis 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_methodsequenceDiagram
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
Sequence diagram for IoP enabled detection based on install_methodsequenceDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
PRT is currently failing with issues around the satellite rex keys. Not related to these code changes |
There was a problem hiding this comment.
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 tosystemctl is-activewhen the API endpoint is unavailable, to avoid changing semantics for satellite-installer setups. - The foremanctl branch in
test_positive_install_iop_custom_certsomits use ofcerts_server_ca_certthat was previously passed viasatellite-installer; verify whether an equivalent CA bundle option is needed forforemanctl deployand wire it through if so. - You now import
InstallMethodin multiple places (module-level and insideiop_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.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``, |
There was a problem hiding this comment.
Do you mean to say "Based on install_method..."?
There was a problem hiding this comment.
Yeah, I can change this
| result = self.execute('foremanctl deploy --add-feature iop', timeout='30m') | ||
| else: | ||
| # Set up container image path overrides for satellite-installer |
There was a problem hiding this comment.
How and where do you override the image paths for foremanctl to deploy IOP containers, as similar to traditional installer's custom hiera?
There was a problem hiding this comment.
I wasnt aware that we need to override the image paths for foremanctl. If that is necessary, I can add it in
| 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 |
There was a problem hiding this comment.
Can we have this import at module/file level, instead of keeping for each property?
There was a problem hiding this comment.
I can look into this yes
| @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'] |
There was a problem hiding this comment.
Just curious, Is this API not available on foremanctl deployment? or am I missing some update around this?
There was a problem hiding this comment.
Correct this endpoint should have been removed and it open here theforeman/foreman_rh_cloud#1226
| if module_satellite_iop.install_method == InstallMethod.FOREMANCTL: | ||
| pytest.skip( | ||
| 'IoP log level configuration via satellite-installer not available on foremanctl' | ||
| ) | ||
|
|
There was a problem hiding this comment.
Just fyi, after #22007, we can mark this test with @pytest.mark.foreman_installer so it gets skipped on foremanctl
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_configUpdated 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:
Enhancements:
Tests: