Skip to content

Commit

Permalink
Ipv6 Capsule is enabled for CDN communication via Proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
jyejare committed Mar 20, 2024
1 parent ae57fd4 commit ca539f0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
12 changes: 8 additions & 4 deletions pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ def cached_capsule_cdn_register(hostname=None):
def _target_capsule_host(request, capsule_factory):
if 'sanity' not in request.config.option.markexpr and not request.config.option.n_minus:
new_cap = capsule_factory()
new_cap.enable_ipv6_http_proxy()
yield new_cap
new_cap.teardown()
new_cap.disable_ipv6_http_proxy()
Broker(hosts=[new_cap]).checkin()
elif request.config.option.n_minus:
if not settings.capsule.hostname:
Expand Down Expand Up @@ -96,9 +98,10 @@ def factory(retry_limit=3, delay=300, workflow=None, **broker_args):
def large_capsule_host(capsule_factory):
"""A fixture that provides a Capsule based on config settings"""
new_cap = capsule_factory(deploy_flavor=settings.flavors.custom_db)
# TO_DO - a question to resolve - How does the dynamic capsule talks to the CDN for contents ?
new_cap.enable_ipv6_http_proxy()
yield new_cap
new_cap.teardown()
new_cap.disable_ipv6_http_proxy()
Broker(hosts=[new_cap]).checkin()


Expand All @@ -120,7 +123,6 @@ def factory(retry_limit=3, delay=300, workflow=None, **broker_args):
)
timeout = (1200 + delay) * retry_limit
cap = wait_for(vmb.checkout, timeout=timeout, delay=delay, fail_condition=[])
## TO-DO: Need to add http proxy here for this capsule to talk outside/CDN
return cap.out

return factory
Expand Down Expand Up @@ -248,10 +250,11 @@ def module_lb_capsule(retry_limit=3, delay=300, **broker_args):
)
cap_hosts = wait_for(hosts.checkout, timeout=timeout, delay=delay)

## TO_DO : Need to add Proxy here for these capsules
[cap.enable_ipv6_http_proxy() for cap in cap_hosts.out]
yield cap_hosts.out

[cap.teardown() for cap in cap_hosts.out]
[cap.disable_ipv6_http_proxy() for cap in cap_hosts.out]
Broker(hosts=cap_hosts.out).checkin()


Expand Down Expand Up @@ -328,8 +331,9 @@ def cap_ready_rhel():
'workflow': settings.capsule.deploy_workflows.os,
}
with Broker(**deploy_args, host_class=Capsule) as host:
## TO_DO: Need to add Proxy here for this capsule
host.enable_ipv6_http_proxy()
yield host
host.disable_ipv6_http_proxy()


@pytest.fixture(scope='session')
Expand Down
12 changes: 11 additions & 1 deletion robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,17 @@ def enable_capsule_downstream_repos(self):
snap=settings.capsule.version.snap,
)

def enable_ipv6_http_proxy(self):
if settings.server.is_ipv6 and settings.server.http_proxy_ipv6_url:
url = urlparse(settings.server.http_proxy_ipv6_url)
self.execute(
f'subscription-manager config --server.proxy_hostname={url.hostname} --server.proxy_port={url.port}'
)

def disable_ipv6_http_proxy(self):
if settings.server.is_ipv6:
self.execute('subscription-manager remove server.proxy_hostname server.proxy_port')

def capsule_setup(self, sat_host=None, capsule_cert_opts=None, **installer_kwargs):
"""Prepare the host and run the capsule installer"""
self._satellite = sat_host or Satellite()
Expand Down Expand Up @@ -1650,7 +1661,6 @@ def capsule_setup(self, sat_host=None, capsule_cert_opts=None, **installer_kwarg
self.satellite.session.remote_copy(certs_tar, self)
installer.update(**installer_kwargs)
result = self.install(installer)
## TO_DO : Add a http proxy for this to communicate outside
if result.status:
# before exit download the capsule log file
self.session.sftp_read(
Expand Down

0 comments on commit ca539f0

Please sign in to comment.