Skip to content
This repository was archived by the owner on May 18, 2020. It is now read-only.

Commit bd6548c

Browse files
pukkaonegaczm
authored andcommitted
Install plugin with --batch option in Elasticsearch 5.x or later (#59)
Before Elasticsearch 6.3.0, if a plugin requires additional permissions, and standard input is closed or there is no console, then the plugin is installed without asking the user to acknowledge the additional permissions. Elasticsearch 6.3.0 introduced a breaking change where it waits for the user to acknowledge, unless the install command is run with the --batch option. Elasticsearch 5.x introduced this option.
1 parent a5d2a31 commit bd6548c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

core/src/main/java/pl/allegro/tech/embeddedelasticsearch/ElasticSearchInstaller.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ private String[] prepareInstallCommand(File pluginManager, Plugin plugin) {
128128
if (installationDescription.versionIs1x() && plugin.expressionIsUrl()) {
129129
return new String[]{pluginManager.getAbsolutePath(), "--install", plugin.getPluginName(), "--url", plugin.getExpression()};
130130
}
131-
return new String[]{pluginManager.getAbsolutePath(), "install", plugin.getExpression()};
131+
if (installationDescription.versionIs1x() || installationDescription.versionIs2x()) {
132+
return new String[]{pluginManager.getAbsolutePath(), "install", plugin.getExpression()};
133+
}
134+
return new String[]{pluginManager.getAbsolutePath(), "install", "--batch", plugin.getExpression()};
132135
}
133136

134137
private File pluginManagerExecutable() throws IOException {

core/src/main/java/pl/allegro/tech/embeddedelasticsearch/InstallationDescription.java

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ boolean versionIs1x() {
5656
return getVersion().startsWith("1.");
5757
}
5858

59+
boolean versionIs2x() {
60+
return getVersion().startsWith("2.");
61+
}
62+
5963
boolean isCleanInstallationDirectoryOnStop() {
6064
return cleanInstallationDirectoryOnStop;
6165
}

0 commit comments

Comments
 (0)