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

[6.16.z] Set DNF proxy for IPv6 runs #16285

Merged
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
15 changes: 11 additions & 4 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,16 @@ def enable_rhsm_proxy(self, hostname, port=None):
cmd += f' --server.proxy_port={port}'
self.execute(cmd)

def enable_dnf_proxy(self, hostname, scheme=None, port=None):
"""Configures proxy for dnf"""
if not scheme:
scheme = 'http'
cmd = f"echo -e 'proxy = {scheme}://{hostname}"
if port:
cmd += f':{port}'
cmd += "' >> /etc/dnf/dnf.conf"
self.execute(cmd)

def add_authorized_key(self, pub_key):
"""Inject a public key into the authorized keys file

Expand Down Expand Up @@ -1689,10 +1699,6 @@ def enable_satellite_or_capsule_module_for_rhel8(self):
Note: Make sure required repos are enabled before using this.
"""
if self.os_version.major == 8:
if settings.server.is_ipv6:
self.execute(
f"echo -e 'proxy={settings.server.http_proxy_ipv6_url}' >> /etc/dnf/dnf.conf"
)
assert (
self.execute(
f'dnf -y module enable {self.product_rpm_name}:el{self.os_version.major}'
Expand Down Expand Up @@ -2325,6 +2331,7 @@ def register_contenthost(
if enable_proxy and settings.server.is_ipv6:
url = urlparse(settings.server.http_proxy_ipv6_url)
self.enable_rhsm_proxy(url.hostname, url.port)
self.enable_dnf_proxy(url.hostname, url.scheme, url.port)
return super().register_contenthost(
org=org, lce=lce, username=username, password=password, enable_proxy=enable_proxy
)
Expand Down