File tree 1 file changed +16
-2
lines changed
src/grimoirelab/core/scheduler/tasks
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 22
22
import json
23
23
import logging
24
24
import typing
25
- import urllib3
26
25
26
+ import certifi
27
27
import redis
28
28
import rq .job
29
+ import urllib3
29
30
30
31
from django .conf import settings
31
32
from opensearchpy import OpenSearch , RequestError
33
+ from urllib3 .util import create_urllib3_context
32
34
33
35
34
36
if typing .TYPE_CHECKING :
@@ -393,7 +395,19 @@ def __init__(
393
395
if user and password :
394
396
auth = (user , password )
395
397
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
+ )
397
411
self ._create_index (db_name )
398
412
self .max_items_bulk = 100
399
413
You can’t perform that action at this time.
0 commit comments