@@ -32,7 +32,7 @@ def __init__(
32
32
self ,
33
33
image = "opensearchproject/opensearch:2.4.0" ,
34
34
port_to_expose = 9200 ,
35
- security_disabled = True ,
35
+ security_enabled = False ,
36
36
** kwargs ,
37
37
):
38
38
"""
@@ -41,17 +41,17 @@ def __init__(
41
41
Defaults to "opensearchproject/opensearch:2.4.0".
42
42
port_to_expose (int, optional): The port to expose on the container.
43
43
Defaults to 9200.
44
- security_disabled (bool, optional): `True ` disables the security plugin in OpenSearch.
45
- Defaults to True .
44
+ security_enabled (bool, optional): `False ` disables the security plugin in OpenSearch.
45
+ Defaults to False .
46
46
"""
47
47
super (OpenSearchContainer , self ).__init__ (image , ** kwargs )
48
48
self .port_to_expose = port_to_expose
49
- self .security_disabled = security_disabled
49
+ self .security_enabled = security_enabled
50
50
51
51
self .with_exposed_ports (self .port_to_expose )
52
52
self .with_env ("discovery.type" , "single-node" )
53
- self .with_env ("plugins.security.disabled" , f"{ 'true ' if security_disabled else 'false ' } " )
54
- if not security_disabled :
53
+ self .with_env ("plugins.security.disabled" , f"{ 'false ' if security_enabled else 'true ' } " )
54
+ if security_enabled :
55
55
self .with_env ("plugins.security.allow_default_init_securityindex" , "true" )
56
56
57
57
def get_config (self ):
@@ -78,15 +78,15 @@ def get_client(self, verify_certs: bool = False, **kwargs) -> OpenSearch:
78
78
"""
79
79
config = self .get_config ()
80
80
return OpenSearch (
81
- hosts = [
81
+ hosts = [
82
82
{
83
83
"host" : config ["host" ],
84
84
"port" : config ["port" ],
85
85
}
86
86
],
87
- http_auth = (config ["user" ], config ["password" ]),
88
- use_ssl = not self .security_disabled ,
89
- verify_certs = verify_certs ,
87
+ http_auth = (config ["user" ], config ["password" ]),
88
+ use_ssl = self .security_enabled ,
89
+ verify_certs = verify_certs ,
90
90
** kwargs ,
91
91
)
92
92
0 commit comments