Skip to content
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

Post deployments for content hosts, starting with FIPS #16903

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions conf/content_host.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,60 @@ content_host:
default_rhel_version: 7
rhel6:
vm:
workflow: deploy-base-rhel
workflow: deploy-rhel
deploy_rhel_version: '6'
target_memory: 1GiB
jyejare marked this conversation as resolved.
Show resolved Hide resolved
target_cores: 1
container:
container_host: rhel6:latest
rhel7:
vm:
workflow: deploy-base-rhel
workflow: deploy-rhel
deploy_rhel_version: '7'
target_memory: 1GiB
target_cores: 1
container:
container_host: ubi7:latest
rhel7_fips:
vm:
workflow: deploy-base-rhel-fips
workflow: deploy-rhel
deploy_rhel_version: '7'
target_memory: 1GiB
target_cores: 1
rhel8:
vm:
workflow: deploy-base-rhel
workflow: deploy-rhel
deploy_rhel_version: '8'
target_memory: 1536 MiB
target_cores: 1
Comment on lines 29 to 30
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

target_cores and target_memory options can be removed since it won't do anything for VM deployed in RHOS

container:
container_host: ubi8:latest
rhel8_fips:
vm:
workflow: deploy-base-rhel-fips
workflow: deploy-rhel
deploy_rhel_version: '8'
target_memory: 1536 MiB
target_cores: 1
rhel9:
vm:
workflow: deploy-base-rhel
workflow: deploy-rhel
deploy_rhel_version: '9'
target_memory: 1536 MiB
target_cores: 1
container:
container_host: ubi9:latest
rhel9_fips:
vm:
workflow: deploy-base-rhel-fips
workflow: deploy-rhel
jyejare marked this conversation as resolved.
Show resolved Hide resolved
deploy_rhel_version: '9'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
deploy_rhel_version: '9'
deploy_rhel_version: '9'
deploy_fips_enable: true

target_memory: 1536 MiB
target_cores: 1
rhel10_fips:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rhel10_fips:
rhel10:

vm:
workflow: deploy-template
deploy_rhel_version: '10'
target_memory: 1536 MiB
target_cores: 1
centos7:
vm:
workflow: deploy-centos
Expand Down
3 changes: 3 additions & 0 deletions pytest_fixtures/core/contenthosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ 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'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if 'fips' in params.get('rhel_version'):
if 'rhel10_fips' in params.get('rhel_version'):

deploy_kwargs.update({'fips': True})
conf.update(deploy_kwargs)
return conf

Expand Down
8 changes: 8 additions & 0 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down