Skip to content

Commit

Permalink
Ohsnap connect through proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
jyejare committed May 29, 2024
1 parent ffacb2f commit 589c404
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion robottelo/host_helpers/contenthost_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
12 changes: 8 additions & 4 deletions robottelo/utils/ohsnap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 589c404

Please sign in to comment.