Skip to content

Commit

Permalink
Set DNF proxy for IPv6 runs (#16274)
Browse files Browse the repository at this point in the history
  • Loading branch information
ogajduse authored Sep 9, 2024
1 parent bb1b4e6 commit 1f32750
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,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 @@ -1690,10 +1700,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 @@ -2326,6 +2332,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

0 comments on commit 1f32750

Please sign in to comment.