From a79da44f45e7ebfa53c49d9d8a20cfd538a51e82 Mon Sep 17 00:00:00 2001 From: Gaurav Talreja Date: Thu, 7 Nov 2024 18:12:50 +0530 Subject: [PATCH] Enable IPv6 proxy when settings.server.is_ipv6=True in IPv6 runs (#16795) * Enable IPv6 proxy for puppet tests in IPv6 runs Signed-off-by: Gaurav Talreja * Remove use of enable_proxy option and enable proxy as per setting for IPv6 Signed-off-by: Gaurav Talreja --------- Signed-off-by: Gaurav Talreja --- pytest_fixtures/core/sat_cap_factory.py | 2 +- robottelo/hosts.py | 30 ++++++++----------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/pytest_fixtures/core/sat_cap_factory.py b/pytest_fixtures/core/sat_cap_factory.py index 255bf177f1b..ba245ee3493 100644 --- a/pytest_fixtures/core/sat_cap_factory.py +++ b/pytest_fixtures/core/sat_cap_factory.py @@ -357,7 +357,7 @@ def installer_satellite(request): sat.setup_firewall() # register to cdn (also enables rhel repos from cdn) - sat.register_to_cdn(enable_proxy=True) + sat.register_to_cdn() # setup source repositories if settings.server.version.source == "ga": diff --git a/robottelo/hosts.py b/robottelo/hosts.py index 5e38a640b68..642824ebf75 100644 --- a/robottelo/hosts.py +++ b/robottelo/hosts.py @@ -748,7 +748,6 @@ def register_contenthost( auto_attach=False, serverurl=None, baseurl=None, - enable_proxy=False, ): """Registers content host on foreman server either by specifying organization name and activation key name or by specifying organization @@ -1437,15 +1436,21 @@ def install_tracer(self): raise ContentHostError('There was an error installing katello-host-tools-tracer') self.execute('katello-tracer-upload') - def register_to_cdn(self, pool_ids=None, enable_proxy=False): + def register_to_cdn(self, pool_ids=None): """Subscribe satellite to CDN""" self.reset_rhsm() + + # Enabling proxy for IPv6 + if 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) + cmd_result = self.register_contenthost( org=None, lce=None, username=settings.subscription.rhn_username, password=settings.subscription.rhn_password, - enable_proxy=enable_proxy, ) if cmd_result.status != 0: raise ContentHostError( @@ -1611,6 +1616,7 @@ def enable_ipv6_http_proxy(self): if 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) self.ipv6 = settings.server.is_ipv6 def disable_ipv6_http_proxy(self): @@ -2360,24 +2366,6 @@ def sync_inventory_status(self, org): ) return inventory_sync - def register_contenthost( - self, - org='Default_Organization', - lce='Library', - username=settings.server.admin_username, - password=settings.server.admin_password, - enable_proxy=False, - ): - """Satellite Registration to CDN""" - # Enabling proxy for IPv6 - 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 - ) - def run_orphan_cleanup(self, smart_proxy_id=None): """Run orphan cleanup task for all or given smart proxy.""" timestamp = datetime.utcnow().replace(microsecond=0)