-
Notifications
You must be signed in to change notification settings - Fork 138
Update iop for foremanctl #22066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Update iop for foremanctl #22066
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -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. | ||
|
|
||
| Based on install_method: foremanctl uses ``foremanctl deploy --add-feature iop``, | ||
| installer uses ``satellite-installer --enable-iop --iop-ensure present``. | ||
| """ | ||
| logger.info('Configuring Satellite with local Red Hat Lightspeed') | ||
|
|
||
| self.register_to_cdn() | ||
|
|
@@ -472,30 +476,39 @@ 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, | ||
| if self.install_method == InstallMethod.FOREMANCTL: | ||
| for service, image in settings.rh_cloud.iop.image_paths.items(): | ||
| quadlet_name = f'iop-{service.replace("_", "-")}' | ||
| self.execute( | ||
| f"sed -i 's|^Image=.*|Image={image}|' " | ||
| f"/etc/containers/systemd/{quadlet_name}.image" | ||
| ) | ||
| 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('foremanctl deploy --add-feature iop', timeout='30m') | ||
| else: | ||
| # Set up container image path overrides for satellite-installer | ||
|
Comment on lines
+488
to
+490
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| 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') | ||
|
|
||
| result = self.execute(command, timeout='30m') | ||
| if result.status != 0: | ||
| raise SatelliteHostError(f'Failed to configure IoP: {result.stdout}') | ||
| if not self.iop_enabled: | ||
|
|
@@ -506,11 +519,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: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ | |
| RHSSO_USER_UPDATE, | ||
| SATELLITE_VERSION, | ||
| ) | ||
| from robottelo.enums import NetworkType | ||
| from robottelo.enums import InstallMethod, NetworkType | ||
| from robottelo.exceptions import ( | ||
| CapsuleHostError, | ||
| CLIFactoryError, | ||
|
|
@@ -1805,7 +1805,6 @@ def detect_install_method(self): | |
| :return: InstallMethod enum value | ||
| :rtype: InstallMethod | ||
| """ | ||
| from robottelo.enums import InstallMethod | ||
|
|
||
| # Runtime override | ||
| if hasattr(self, '_install_method_override'): | ||
|
|
@@ -1855,7 +1854,6 @@ def get_service_names(self): | |
| :rtype: list | ||
| """ | ||
| from robottelo.constants import InstallationServices | ||
| from robottelo.enums import InstallMethod | ||
|
|
||
| if self.install_method == InstallMethod.FOREMANCTL: | ||
| return InstallationServices.FOREMANCTL_SERVICES | ||
|
|
@@ -2268,7 +2266,6 @@ def install_satellite( | |
| :param foremanctl_parameters: Parameters list for foremanctl deploy | ||
| :return: Installation result | ||
| """ | ||
| from robottelo.enums import InstallMethod | ||
| from robottelo.utils.installer import InstallerCommand | ||
|
|
||
| # Determine method | ||
|
|
@@ -3150,7 +3147,11 @@ 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'] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
|
|
||
| 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): | ||
|
|
||
There was a problem hiding this comment.
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_methodinstead