diff --git a/conf/content_host.yaml.template b/conf/content_host.yaml.template index 1d505820c52..5804c383f43 100644 --- a/conf/content_host.yaml.template +++ b/conf/content_host.yaml.template @@ -50,6 +50,12 @@ content_host: deploy_rhel_version: '9' target_memory: 1536 MiB target_cores: 1 + rhel10_fips: + vm: + workflow: deploy-template + deploy_rhel_version: '10' + target_memory: 1536 MiB + target_cores: 1 centos7: vm: workflow: deploy-centos diff --git a/pytest_fixtures/core/contenthosts.py b/pytest_fixtures/core/contenthosts.py index 40eaf374ba4..5dd65375ebb 100644 --- a/pytest_fixtures/core/contenthosts.py +++ b/pytest_fixtures/core/contenthosts.py @@ -37,26 +37,19 @@ def host_conf(request): deploy_kwargs = settings.content_host.get(_rhelver).to_dict().get('vm', {}) if network := params.get('network'): deploy_kwargs.update({'deploy_network_type': network}) + # Post_deploy_workflow_runs to be run in ContentHost.setup method + if 'fips' in params.get('rhel_version'): + deploy_kwargs.update({'fips': True}) conf.update(deploy_kwargs) return conf -def run_post_deployments(request, host): - """Execute post deploy""" - params = {} - if hasattr(request, 'param'): - params = request.param - if 'fips' in params.get('rhel_version'): - Broker().execute(workflow='enable-fips', target_host=host.name) - - @pytest.fixture def rhel_contenthost(request): """A function-level fixture that provides a content host object parametrized""" # Request should be parametrized through pytest_fixtures.fixture_markers # unpack params dict with Broker(**host_conf(request), host_class=ContentHost) as host: - run_post_deployments(request, host) yield host @@ -66,7 +59,6 @@ def module_rhel_contenthost(request): # Request should be parametrized through pytest_fixtures.fixture_markers # unpack params dict with Broker(**host_conf(request), host_class=ContentHost) as host: - run_post_deployments(request, host) yield host @@ -123,8 +115,6 @@ def rhel9_contenthost(request): def content_hosts(request): """A function-level fixture that provides two rhel content hosts object""" with Broker(**host_conf(request), host_class=ContentHost, _count=2) as hosts: - for host in hosts: - run_post_deployments(request, host) hosts[0].set_infrastructure_type('physical') yield hosts @@ -133,8 +123,6 @@ def content_hosts(request): def mod_content_hosts(request): """A module-level fixture that provides two rhel content hosts object""" with Broker(**host_conf(request), host_class=ContentHost, _count=2) as hosts: - for host in hosts: - run_post_deployments(request, host) hosts[0].set_infrastructure_type('physical') yield hosts @@ -187,7 +175,6 @@ def cockpit_host(class_target_sat, class_org, rhel_contenthost): def rex_contenthost(request, module_org, target_sat, module_ak_with_cv): request.param['no_containers'] = True with Broker(**host_conf(request), host_class=ContentHost) as host: - run_post_deployments(request, host) repo = settings.repos['SATCLIENT_REPO'][f'RHEL{host.os_version.major}'] host.register( module_org, None, module_ak_with_cv.name, target_sat, repo_data=f'repo={repo}' @@ -200,7 +187,6 @@ def rex_contenthosts(request, module_org, target_sat, module_ak_with_cv): request.param['no_containers'] = True with Broker(**host_conf(request), host_class=ContentHost, _count=2) as hosts: for host in hosts: - run_post_deployments(request, host) repo = settings.repos['SATCLIENT_REPO'][f'RHEL{host.os_version.major}'] host.register( module_org, None, module_ak_with_cv.name, target_sat, repo_data=f'repo={repo}' diff --git a/robottelo/hosts.py b/robottelo/hosts.py index 5e38a640b68..dd95adebf2c 100644 --- a/robottelo/hosts.py +++ b/robottelo/hosts.py @@ -147,6 +147,7 @@ def __init__(self, hostname, auth=None, **kwargs): self._satellite = kwargs.get('satellite') self.ipv6 = kwargs.get('ipv6', settings.server.is_ipv6) self.blank = kwargs.get('blank', False) + self.fips = kwargs.get('fips', False) super().__init__(hostname=hostname, **kwargs) @classmethod @@ -336,10 +337,17 @@ def clean_cached_properties(self): with contextlib.suppress(KeyError): # ignore if property is not cached del self.__dict__[name] + def enable_fips(self): + logger.debug(f'Enabling FIPS on the host {self.name}') + Broker().execute(workflow='enable-fips', target_host=self.name) + logger.debug(f'Enabling FIPS on the host {self.name} finished.') + def setup(self): logger.debug('START: setting up host %s', self) if not self.blank: self.reset_rhsm() + if self.fips: + self.enable_fips() logger.debug('END: setting up host %s', self)