Commit c96a6b3c authored by Andrew Leonard's avatar Andrew Leonard
Browse files

Have fetch load ssl and user certs and set downloader client session

parent 0c44a495
......@@ -26,6 +26,8 @@ from urllib.error import HTTPError, URLError
import json
import parfive
from rucio.client import Client
import aiohttp
import ssl
walker = AttrWalker()
......@@ -338,6 +340,8 @@ class KISClient(BaseClient):
if not len(query_results):
return
downloader.config.config.aiohttp_session_generator = self._load_ssl_certs
for row in query_results:
scope, name = row['links'].split(':')
......@@ -351,6 +355,14 @@ class KISClient(BaseClient):
**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)
@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