From 589c404ae448f2b7f57976d2c6ef80cd54175d6e Mon Sep 17 00:00:00 2001 From: jyejare Date: Wed, 29 May 2024 18:10:18 +0530 Subject: [PATCH] Ohsnap connect through proxy --- robottelo/host_helpers/contenthost_mixins.py | 5 ++++- robottelo/utils/ohsnap.py | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/robottelo/host_helpers/contenthost_mixins.py b/robottelo/host_helpers/contenthost_mixins.py index c76d23405fe..a0999cc8283 100644 --- a/robottelo/host_helpers/contenthost_mixins.py +++ b/robottelo/host_helpers/contenthost_mixins.py @@ -94,7 +94,10 @@ def download_repofile(self, product=None, release=None, snap=''): """Downloads the tools/client, capsule, or satellite repos on the machine""" product, release, v_major, _ = self._dogfood_helper(product, release) url = dogfood_repofile_url(settings.ohsnap, product, release, v_major, snap) - self.execute(f'curl -o /etc/yum.repos.d/dogfood.repo -L {url}') + command = f'curl -o /etc/yum.repos.d/dogfood.repo -L {url}' + if settings.server.is_ipv6: + command += f' -x {settings.server.http_proxy_ipv6_url}' + self.execute(command) def dogfood_repository(self, repo=None, product=None, release=None, snap=''): """Returns a repository definition based on the arguments provided""" diff --git a/robottelo/utils/ohsnap.py b/robottelo/utils/ohsnap.py index 83669cdb61e..7ca11d8e6b8 100644 --- a/robottelo/utils/ohsnap.py +++ b/robottelo/utils/ohsnap.py @@ -6,6 +6,7 @@ from wait_for import wait_for from robottelo import constants +from robottelo.config import settings from robottelo.exceptions import InvalidArgumentError, RepositoryDataNotFound from robottelo.logging import logger @@ -42,11 +43,14 @@ def ohsnap_repo_url(ohsnap, request_type, product, release, os_release, snap='') f'.z version component not provided in the release ({release}),' f' fetching the recent z-stream from ohsnap' ) + request_query = { + 'url': f'{ohsnap.host}/api/streams', + 'hooks': {'response': ohsnap_response_hook}, + } + if settings.server.is_ipv6: + request_query['proxies'] = {'http': settings.server.http_proxy_ipv6_url} res, _ = wait_for( - lambda: requests.get( - f'{ohsnap.host}/api/streams', - hooks={'response': ohsnap_response_hook}, - ), + lambda: requests.get(**request_query), handle_exception=True, raise_original=True, timeout=ohsnap.request_retry.timeout,