Commit 049cebe4 authored by Andrew Leonard's avatar Andrew Leonard
Browse files

SSL context can be passed directly into enqueue_file, it turns out

parent c96a6b3c
......@@ -340,7 +340,10 @@ class KISClient(BaseClient):
if not len(query_results):
return
downloader.config.config.aiohttp_session_generator = self._load_ssl_certs
# Create SSL context to use SSL cert and rucio user credentials
creds = self.rucio.creds
ssl_ctx = ssl.create_default_context(cafile=self.rucio.ca_cert)
ssl_ctx.load_cert_chain(creds['client_cert'], creds['client_key'])
for row in query_results:
scope, name = row['links'].split(':')
......@@ -353,15 +356,8 @@ class KISClient(BaseClient):
downloader.enqueue_file(url.replace('davs', 'https'),
filename=str(path).format(file=filepath,
**row.response_block_map),
headers=self.rucio.headers)
def _load_ssl_certs(self, config):
creds = self.rucio.creds
ssl_ctx = ssl.create_default_context(cafile=self.rucio.ca_cert)
ssl_ctx.load_cert_chain(creds['client_cert'], creds['client_key'])
conn = aiohttp.TCPConnector(ssl=ssl_ctx)
return aiohttp.ClientSession(connector=conn, headers=config.headers)
headers=self.rucio.headers,
ssl=ssl_ctx)
@classmethod
def _can_handle_query(cls, *query, hasinstr=False):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment