Introduce plugin-specific env scripts

With plugins of a meta-plugin now loaded in separate classloaders, we
should not be loading all classes in all plugins of a meta-plugin when
executing scripts. This is particularly problematic in the case of
security extensions where the install plugin extension command would be
running with the classpath of all plugins. However, if there is JAR hell
in this classpath, installation would fail. This is not realistic though
since the plugins are run in separate classloaders. To fix this, for the
scripts of a plugin, we only set the classpath to include the JARs for
that plugin and the JARs of core. This leads us to the introduction of
plugin-specific env scripts.

Relates elastic/x-pack-elasticsearch#3649

Original commit: elastic/x-pack-elasticsearch@543df37eed
This commit is contained in:
Jason Tedor 2018-01-20 15:56:00 -05:00 committed by GitHub
parent 51c53710d7
commit 50864eabce
22 changed files with 50 additions and 26 deletions

View File

@ -5,8 +5,3 @@
# you may not use this file except in compliance with the Elastic License. # you may not use this file except in compliance with the Elastic License.
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/x-pack-core/*" ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/x-pack-core/*"
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/x-pack-logstash/*"
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/x-pack-ml/*"
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/x-pack-monitoring/*"
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/x-pack-security/*"
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/x-pack-watcher/*"

View File

@ -3,8 +3,3 @@ rem or more contributor license agreements. Licensed under the Elastic License;
rem you may not use this file except in compliance with the Elastic License. rem you may not use this file except in compliance with the Elastic License.
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/plugins/x-pack/x-pack-core/* set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/plugins/x-pack/x-pack-core/*
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/plugins/x-pack/x-pack-logstash*
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/plugins/x-pack/x-pack-ml/*
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/plugins/x-pack/x-pack-monitoring/*
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/plugins/x-pack/x-pack-security/*
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/plugins/x-pack/x-pack-watcher/*

View File

@ -6,7 +6,7 @@
source "`dirname "$0"`"/../elasticsearch-env source "`dirname "$0"`"/../elasticsearch-env
source "`dirname "$0"`"/x-pack-env source "`dirname "$0"`"/x-pack-security-env
exec \ exec \
"$JAVA" \ "$JAVA" \

View File

@ -9,7 +9,7 @@ setlocal enableextensions
call "%~dp0..\elasticsearch-env.bat" || exit /b 1 call "%~dp0..\elasticsearch-env.bat" || exit /b 1
call "%~dp0x-pack-env.bat" || exit /b 1 call "%~dp0x-pack-security-env.bat" || exit /b 1
%JAVA% ^ %JAVA% ^
%ES_JAVA_OPTS% ^ %ES_JAVA_OPTS% ^

View File

@ -6,7 +6,7 @@
source "`dirname "$0"`"/../elasticsearch-env source "`dirname "$0"`"/../elasticsearch-env
source "`dirname "$0"`"/x-pack-env source "`dirname "$0"`"/x-pack-security-env
exec \ exec \
"$JAVA" \ "$JAVA" \

View File

@ -9,7 +9,7 @@ setlocal enableextensions
call "%~dp0..\elasticsearch-env.bat" || exit /b 1 call "%~dp0..\elasticsearch-env.bat" || exit /b 1
call "%~dp0x-pack-env.bat" || exit /b 1 call "%~dp0x-pack-security-env.bat" || exit /b 1
%JAVA% ^ %JAVA% ^
%ES_JAVA_OPTS% ^ %ES_JAVA_OPTS% ^

View File

@ -6,7 +6,7 @@
source "`dirname "$0"`"/../elasticsearch-env source "`dirname "$0"`"/../elasticsearch-env
source "`dirname "$0"`"/x-pack-env source "`dirname "$0"`"/x-pack-security-env
exec \ exec \
"$JAVA" \ "$JAVA" \

View File

@ -9,7 +9,7 @@ setlocal enableextensions
call "%~dp0..\elasticsearch-env.bat" || exit /b 1 call "%~dp0..\elasticsearch-env.bat" || exit /b 1
call "%~dp0x-pack-env.bat" || exit /b 1 call "%~dp0x-pack-security-env.bat" || exit /b 1
%JAVA% ^ %JAVA% ^
%ES_JAVA_OPTS% ^ %ES_JAVA_OPTS% ^

View File

@ -6,7 +6,7 @@
source "`dirname "$0"`"/../elasticsearch-env source "`dirname "$0"`"/../elasticsearch-env
source "`dirname "$0"`"/x-pack-env source "`dirname "$0"`"/x-pack-security-env
exec \ exec \
"$JAVA" \ "$JAVA" \

View File

@ -9,7 +9,7 @@ setlocal enableextensions
call "%~dp0..\elasticsearch-env.bat" || exit /b 1 call "%~dp0..\elasticsearch-env.bat" || exit /b 1
call "%~dp0x-pack-env.bat" || exit /b 1 call "%~dp0x-pack-security-env.bat" || exit /b 1
%JAVA% ^ %JAVA% ^
%ES_JAVA_OPTS% ^ %ES_JAVA_OPTS% ^

View File

@ -6,7 +6,7 @@
source "`dirname "$0"`"/../elasticsearch-env source "`dirname "$0"`"/../elasticsearch-env
source "`dirname "$0"`"/x-pack-env source "`dirname "$0"`"/x-pack-security-env
exec \ exec \
"$JAVA" \ "$JAVA" \

View File

@ -9,7 +9,7 @@ setlocal enableextensions
call "%~dp0..\elasticsearch-env.bat" || exit /b 1 call "%~dp0..\elasticsearch-env.bat" || exit /b 1
call "%~dp0x-pack-env.bat" || exit /b 1 call "%~dp0x-pack-security-env.bat" || exit /b 1
%JAVA% ^ %JAVA% ^
%ES_JAVA_OPTS% ^ %ES_JAVA_OPTS% ^

View File

@ -6,7 +6,7 @@
source "`dirname "$0"`"/../elasticsearch-env source "`dirname "$0"`"/../elasticsearch-env
source "`dirname "$0"`"/x-pack-env source "`dirname "$0"`"/x-pack-security-env
exec \ exec \
"$JAVA" \ "$JAVA" \

View File

@ -9,7 +9,7 @@ setlocal enableextensions
call "%~dp0..\elasticsearch-env.bat" || exit /b 1 call "%~dp0..\elasticsearch-env.bat" || exit /b 1
call "%~dp0x-pack-env.bat" || exit /b 1 call "%~dp0x-pack-security-env.bat" || exit /b 1
%JAVA% ^ %JAVA% ^
%ES_JAVA_OPTS% ^ %ES_JAVA_OPTS% ^

View File

@ -6,7 +6,7 @@
source "`dirname "$0"`"/../elasticsearch-env source "`dirname "$0"`"/../elasticsearch-env
source "`dirname "$0"`"/x-pack-env source "`dirname "$0"`"/x-pack-security-env
exec \ exec \
"$JAVA" \ "$JAVA" \

View File

@ -9,7 +9,7 @@ setlocal enableextensions
call "%~dp0..\elasticsearch-env.bat" || exit /b 1 call "%~dp0..\elasticsearch-env.bat" || exit /b 1
call "%~dp0x-pack-env.bat" || exit /b 1 call "%~dp0x-pack-security-env.bat" || exit /b 1
%JAVA% ^ %JAVA% ^
%ES_JAVA_OPTS% ^ %ES_JAVA_OPTS% ^

View File

@ -0,0 +1,10 @@
#!/bin/bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License;
# you may not use this file except in compliance with the Elastic License.
source "`dirname "$0"`"/x-pack-env
# include x-pack-security jars in classpath
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/x-pack-security/*"

View File

@ -0,0 +1,7 @@
rem Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
rem or more contributor license agreements. Licensed under the Elastic License;
rem you may not use this file except in compliance with the Elastic License.
call "%~dp0x-pack-env.bat" || exit /b 1
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/plugins/x-pack/x-pack-security/*

View File

@ -6,7 +6,7 @@
source "`dirname "$0"`"/../elasticsearch-env source "`dirname "$0"`"/../elasticsearch-env
source "`dirname "$0"`"/x-pack-env source "`dirname "$0"`"/x-pack-watcher-env
exec \ exec \
"$JAVA" \ "$JAVA" \

View File

@ -9,7 +9,7 @@ setlocal enableextensions
call "%~dp0..\elasticsearch-env.bat" || exit /b 1 call "%~dp0..\elasticsearch-env.bat" || exit /b 1
call "%~dp0x-pack-env.bat" || exit /b 1 call "%~dp0x-pack-watcher-env.bat" || exit /b 1
%JAVA% ^ %JAVA% ^
%ES_JAVA_OPTS% ^ %ES_JAVA_OPTS% ^

View File

@ -0,0 +1,10 @@
#!/bin/bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License;
# you may not use this file except in compliance with the Elastic License.
source "`dirname "$0"`"/x-pack-env
# include x-pack-security jars in classpath
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/plugins/x-pack/x-pack-watcher/*"

View File

@ -0,0 +1,7 @@
rem Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
rem or more contributor license agreements. Licensed under the Elastic License;
rem you may not use this file except in compliance with the Elastic License.
call "%~dp0x-pack-env.bat" || exit /b 1
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/plugins/x-pack/x-pack-watcher/*