Skip to content

Commit ccf8a71

Browse files
committed
Check for packaged config file in plugin install script
In case you are running the plugin command from a packaged installation like the debian or RPM package, a change of the path.plugins directory in the elasticsearch.yml directory was ignored, because it was not loaded. This change checks for the existence of /etc/elasticsearch/elasticsearch.yml and the absence of $ES_HOME/config/elasticsearch.yml - in that case a package installation is assumed and the -Des.default.config parameter is appended to the JAVA_OPTS if it does not exist yet. Closes elastic#3304
1 parent abf2268 commit ccf8a71

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

bin/plugin

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ ES_HOME=`dirname "$SCRIPT"`/..
2121
# make ELASTICSEARCH_HOME absolute
2222
ES_HOME=`cd "$ES_HOME"; pwd`
2323

24+
# if there is no configuration file in ES_HOME, we might have a packaged version and use it for getting the correct plugin path
25+
if [ ! -e $ES_HOME/config/elasticsearch.yml ] && [ -e /etc/elasticsearch/elasticsearch.yml ]; then
26+
if [ -z $JAVA_OPTS ] ; then
27+
JAVA_OPTS="-Des.default.config=/etc/elasticsearch/elasticsearch.yml"
28+
elif [ -n $JAVA_OPTS ] && [ ! $JAVA_OPTS =~ " -Des.default.config=" ] ; then
29+
JAVA_OPTS="$JAVA_OPTS -Des.default.config=/etc/elasticsearch/elasticsearch.yml"
30+
fi
31+
fi
2432

2533
if [ -x "$JAVA_HOME/bin/java" ]; then
2634
JAVA=$JAVA_HOME/bin/java

0 commit comments

Comments
 (0)