21
21
from localstack .services .opensearch import versions
22
22
from localstack .utils .archives import download_and_extract_with_retry
23
23
from localstack .utils .files import chmod_r , load_file , mkdir , rm_rf , save_file
24
- from localstack .utils .java import java_proxy_cli_args
24
+ from localstack .utils .java import (
25
+ java_system_properties_proxy ,
26
+ java_system_properties_ssl ,
27
+ system_properties_to_cli_args ,
28
+ )
25
29
from localstack .utils .run import run
26
30
from localstack .utils .ssl import create_ssl_cert , install_predefined_cert_if_available
27
31
from localstack .utils .sync import SynchronizedDefaultDict , retry
@@ -66,7 +70,6 @@ def _install(self, target: InstallTarget):
66
70
tmp_archive = os .path .join (
67
71
config .dirs .cache , f"localstack.{ os .path .basename (opensearch_url )} "
68
72
)
69
- print (f"DEBUG: installing opensearch to path { install_dir_parent } " )
70
73
download_and_extract_with_retry (opensearch_url , tmp_archive , install_dir_parent )
71
74
opensearch_dir = glob .glob (os .path .join (install_dir_parent , "opensearch*" ))
72
75
if not opensearch_dir :
@@ -86,20 +89,26 @@ def _install(self, target: InstallTarget):
86
89
# install other default plugins for opensearch 1.1+
87
90
# https://forum.opensearch.org/t/ingest-attachment-cannot-be-installed/6494/12
88
91
if parsed_version >= "1.1.0" :
92
+ # Determine network configuration to use for plugin downloads
93
+ sys_props = {
94
+ ** java_system_properties_proxy (),
95
+ ** java_system_properties_ssl (
96
+ os .path .join (install_dir , "jdk" , "bin" , "keytool" ),
97
+ {"JAVA_HOME" : os .path .join (install_dir , "jdk" )},
98
+ ),
99
+ }
100
+ java_opts = system_properties_to_cli_args (sys_props )
101
+
89
102
for plugin in OPENSEARCH_PLUGIN_LIST :
90
103
plugin_binary = os .path .join (install_dir , "bin" , "opensearch-plugin" )
91
104
plugin_dir = os .path .join (install_dir , "plugins" , plugin )
92
105
if not os .path .exists (plugin_dir ):
93
106
LOG .info ("Installing OpenSearch plugin %s" , plugin )
94
107
95
108
def try_install ():
96
- opts = java_proxy_cli_args () + [
97
- "-Djavax.net.ssl.trustStore=/home/viren/mitmproxycacert.jks" ,
98
- "-Djavax.net.ssl.keyStorePassword=localstack" ,
99
- ]
100
109
output = run (
101
110
[plugin_binary , "install" , "-b" , plugin ],
102
- env_vars = {"CLI_JAVA_OPTS " : " " .join (opts )},
111
+ env_vars = {"OPENSEARCH_JAVA_OPTS " : " " .join (java_opts )},
103
112
)
104
113
LOG .debug ("Plugin installation output: %s" , output )
105
114
@@ -249,6 +258,16 @@ def _install(self, target: InstallTarget):
249
258
mkdir (dir_path )
250
259
chmod_r (dir_path , 0o777 )
251
260
261
+ # Determine network configuration to use for plugin downloads
262
+ sys_props = {
263
+ ** java_system_properties_proxy (),
264
+ ** java_system_properties_ssl (
265
+ os .path .join (install_dir , "jdk" , "bin" , "keytool" ),
266
+ {"JAVA_HOME" : os .path .join (install_dir , "jdk" )},
267
+ ),
268
+ }
269
+ java_opts = system_properties_to_cli_args (sys_props )
270
+
252
271
# install default plugins
253
272
for plugin in ELASTICSEARCH_PLUGIN_LIST :
254
273
plugin_binary = os .path .join (install_dir , "bin" , "elasticsearch-plugin" )
@@ -257,13 +276,9 @@ def _install(self, target: InstallTarget):
257
276
LOG .info ("Installing Elasticsearch plugin %s" , plugin )
258
277
259
278
def try_install ():
260
- opts = java_proxy_cli_args () + [
261
- "-Djavax.net.ssl.trustStore=/home/viren/mitmproxycacert.jks" ,
262
- "-Djavax.net.ssl.keyStorePassword=localstack" ,
263
- ]
264
279
output = run (
265
280
[plugin_binary , "install" , "-b" , plugin ],
266
- env_vars = {"CLI_JAVA_OPTS " : " " .join (opts )},
281
+ env_vars = {"ES_JAVA_OPTS " : " " .join (java_opts )},
267
282
)
268
283
LOG .debug ("Plugin installation output: %s" , output )
269
284
0 commit comments