Skip to content

Commit

Permalink
Configure proxy support for create_custom_repos function
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Ganar <[email protected]>
  • Loading branch information
shubhamsg199 committed Dec 10, 2024
1 parent 2a06c9d commit a1f7c79
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def create_custom_repos(self, **kwargs):
For example::
create_custom_repo(custom_repo='http://repourl.domain.com/path')
create_custom_repo(custom_repo='http://repourl.domain.com/path', proxy='http://proxy.domain.com:1234')
Will create a repository file named ``custom_repo.repo`` with
the following contents::
Expand All @@ -561,10 +561,14 @@ def create_custom_repos(self, **kwargs):
baseurl=http://repourl.domain.com/path
enabled=1
gpgcheck=0
proxy=http://proxy.domain.com:1234
"""
for name, url in kwargs.items():
content = f'[{name}]\n' f'name={name}\n' f'baseurl={url}\n' 'enabled=1\n' 'gpgcheck=0'
content = f'[{name}]\n' f'name={name}\n' f'baseurl={url}\n' 'enabled=1\n' 'gpgcheck=0\n'
# Add proxy configuration for IPv6
if settings.server.is_ipv6:
content += f'proxy={settings.http_proxy.http_proxy_ipv6_url}'
self.execute(f'echo "{content}" > /etc/yum.repos.d/{name}.repo')

def get_base_url_for_older_rhel_minor(self):
Expand Down

0 comments on commit a1f7c79

Please sign in to comment.