Skip to content

Commit b051180

Browse files
authored
Merge pull request #824 from gerrod3/proxy-fix-again
Fix proxy-sync regression
2 parents 088126e + 00f9b83 commit b051180

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a proxy sync regression introduced in 3.13.0.

pulp_python/app/tasks/sync.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
from aiohttp import ClientResponseError, ClientError
44
from lxml.etree import LxmlError
55
from gettext import gettext as _
6+
from functools import partial
67

78
from rest_framework import serializers
89

10+
from pulpcore.plugin.download import HttpDownloader
911
from pulpcore.plugin.models import Artifact, ProgressReport, Remote, Repository
1012
from pulpcore.plugin.stages import (
1113
DeclarativeArtifact,
@@ -112,11 +114,22 @@ async def run(self):
112114
"""
113115
# Bandersnatch includes leading slash when forming API urls
114116
url = self.remote.url.rstrip("/")
117+
downloader = self.remote.get_downloader(url=url)
118+
if not isinstance(downloader, HttpDownloader):
119+
raise ValueError("Only HTTP(S) is supported for python syncing")
120+
115121
async with Master(url) as master:
116122
# Replace the session with the remote's downloader session
117123
old_session = master.session
118-
factory = self.remote.download_factory
119-
master.session = factory._session
124+
master.session = downloader.session
125+
126+
# Set up master.get with remote's auth & proxy settings
127+
master.get = partial(
128+
master.get,
129+
auth=downloader.auth,
130+
proxy=downloader.proxy,
131+
proxy_auth=downloader.proxy_auth,
132+
)
120133

121134
deferred_download = self.remote.policy != Remote.IMMEDIATE
122135
workers = self.remote.download_concurrency or self.remote.DEFAULT_DOWNLOAD_CONCURRENCY

0 commit comments

Comments
 (0)