File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/grimoirelab/core/scheduler/tasks Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 2222import json
2323import logging
2424import typing
25- import urllib3
2625
26+ import certifi
2727import redis
2828import rq .job
29+ import urllib3
2930
3031from django .conf import settings
3132from opensearchpy import OpenSearch , RequestError
33+ from urllib3 .util import create_urllib3_context
3234
3335
3436if typing .TYPE_CHECKING :
@@ -393,7 +395,19 @@ def __init__(
393395 if user and password :
394396 auth = (user , password )
395397
396- self .client = OpenSearch ([url ], http_auth = auth , verify_certs = self .verify_certs )
398+ context = None
399+ if self .verify_certs :
400+ # Use certificates from the local system and certifi
401+ context = create_urllib3_context ()
402+ context .load_default_certs ()
403+ context .load_verify_locations (certifi .where ())
404+
405+ self .client = OpenSearch (
406+ hosts = [url ],
407+ http_auth = auth ,
408+ verify_certs = self .verify_certs ,
409+ ssl_context = context ,
410+ )
397411 self ._create_index (db_name )
398412 self .max_items_bulk = 100
399413
You can’t perform that action at this time.
0 commit comments