Skip to content

Commit c6f0aa8

Browse files
committed
Remove special handling for ingest plugins (#36967)
We added some special handling for installing and removing the ingest-geoip and ingest-user-agent plugins when we converted them to modules. This special handling was done to minimize breaking users in a minor release. However, do not want to maintain this behavior forever so this commit removes that special handling in the master branch so that starting with 7.0.0 this special handling will be gone.
1 parent 9738593 commit c6f0aa8

File tree

4 files changed

+0
-90
lines changed

4 files changed

+0
-90
lines changed

distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,6 @@ void execute(Terminal terminal, String pluginId, boolean isBatch, Environment en
222222
throw new UserException(ExitCodes.USAGE, "plugin id is required");
223223
}
224224

225-
if ("ingest-geoip".equals(pluginId) || "ingest-user-agent".equals(pluginId)) {
226-
throw new UserException(
227-
ExitCodes.OK,
228-
"[" + pluginId + "] is no longer a plugin but instead a module packaged with this distribution of Elasticsearch");
229-
}
230-
231225
if ("x-pack".equals(pluginId)) {
232226
handleInstallXPack(buildFlavor());
233227
}

distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/RemovePluginCommand.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,6 @@ void execute(Terminal terminal, Environment env, String pluginName, boolean purg
111111
*/
112112
if ((!Files.exists(pluginDir) && !Files.exists(pluginConfigDir) && !Files.exists(removing))
113113
|| (!Files.exists(pluginDir) && Files.exists(pluginConfigDir) && !purge)) {
114-
115-
/*
116-
* This is special case handling for ingest-geoip and ingest-user-agent since they are modules now but could have been installed
117-
* from a previous version when they were plugins.
118-
*/
119-
if ("ingest-geoip".equals(pluginName) || "ingest-user-agent".equals(pluginName)) {
120-
throw new UserException(
121-
ExitCodes.OK,
122-
"[" + pluginName + "] is no longer a plugin but instead a module packaged with this distribution of Elasticsearch");
123-
}
124-
125114
final String message = String.format(
126115
Locale.ROOT, "plugin [%s] not found; run 'elasticsearch-plugin list' to get list of installed plugins", pluginName);
127116
throw new UserException(ExitCodes.CONFIG, message);

distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/InstallPluginCommandTests.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -757,27 +757,6 @@ protected boolean addShutdownHook() {
757757
}
758758
}
759759

760-
public void testInstallIngestGeoIp() throws IOException {
761-
runInstallIngestGeoIpOrIngestUserAgentTest("ingest-geoip");
762-
}
763-
764-
public void testInstallIngestUserAgent() throws IOException {
765-
runInstallIngestGeoIpOrIngestUserAgentTest("ingest-user-agent");
766-
}
767-
768-
private void runInstallIngestGeoIpOrIngestUserAgentTest(final String pluginId) throws IOException {
769-
assert "ingest-geoip".equals(pluginId) || "ingest-user-agent".equals(pluginId) : pluginId;
770-
final Environment environment = createEnv(fs, temp).v2();
771-
final UserException exception =
772-
expectThrows(UserException.class, () -> new InstallPluginCommand().execute(terminal, pluginId, false, environment));
773-
assertThat(exception.exitCode, equalTo(ExitCodes.OK));
774-
assertThat(
775-
exception,
776-
hasToString(containsString(
777-
"[" + pluginId + "] is no longer a plugin but instead a module packaged with this distribution of Elasticsearch")));
778-
779-
}
780-
781760
public void testInstallXPack() throws IOException {
782761
runInstallXPackTest(Build.Flavor.DEFAULT, UserException.class, "this distribution of Elasticsearch contains X-Pack by default");
783762
runInstallXPackTest(

distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/RemovePluginCommandTests.java

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.elasticsearch.env.TestEnvironment;
3131
import org.elasticsearch.test.ESTestCase;
3232
import org.elasticsearch.test.VersionUtils;
33-
import org.hamcrest.Matchers;
3433
import org.junit.Before;
3534

3635
import java.io.BufferedReader;
@@ -253,57 +252,6 @@ public void testMissingPluginName() throws Exception {
253252
assertEquals("plugin name is required", e.getMessage());
254253
}
255254

256-
/**
257-
* The ingest-geoip plugin receives special handling because we have re-packaged it as a module; this test ensures that we are still
258-
* able to uninstall an old installation of ingest-geoip.
259-
*
260-
* @throws Exception if an exception is thrown creating or removing the plugin
261-
*/
262-
public void testRemoveIngestGeoIp() throws Exception {
263-
runTestRemoveIngestGeoIpOrIngestUserAgent("ingest-geoip");
264-
}
265-
266-
/**
267-
* The ingest-user-agent plugin receives special handling because we have re-packaged it as a module; this test ensures that we are
268-
* still able to uninstall an old installation of ingest-user-agent.
269-
*
270-
* @throws Exception if an exception is thrown creating or removing the plugin
271-
*/
272-
public void testRemoveIngestUserAgent() throws Exception {
273-
runTestRemoveIngestGeoIpOrIngestUserAgent("ingest-user-agent");
274-
}
275-
276-
private void runTestRemoveIngestGeoIpOrIngestUserAgent(final String name) throws Exception {
277-
assert "ingest-geoip".equals(name) || "ingest-user-agent".equals(name) : name;
278-
createPlugin(
279-
name,
280-
VersionUtils.randomVersionBetween(
281-
random(),
282-
Version.CURRENT.minimumIndexCompatibilityVersion(),
283-
Version.V_6_6_0));
284-
removePlugin(name, home, randomBoolean());
285-
assertThat(Files.exists(env.pluginsFile().resolve(name)), equalTo(false));
286-
assertRemoveCleaned(env);
287-
}
288-
289-
public void testRemoveIngestGeoIpWhenNotInstalled() {
290-
runTestRemoveIngestGeoIpOrIngestUserAgentWhenNotInstalled("ingest-geoip");
291-
}
292-
293-
public void testRemoveIngestUserAgentWhenNotInstalled() {
294-
runTestRemoveIngestGeoIpOrIngestUserAgentWhenNotInstalled("ingest-user-agent");
295-
}
296-
297-
private void runTestRemoveIngestGeoIpOrIngestUserAgentWhenNotInstalled(final String name) {
298-
assert "ingest-geoip".equals(name) || "ingest-user-agent".equals(name) : name;
299-
final UserException e = expectThrows(UserException.class, () -> removePlugin(name, home, randomBoolean()));
300-
assertThat(e.exitCode, equalTo(ExitCodes.OK));
301-
assertThat(
302-
e,
303-
hasToString(Matchers.containsString(
304-
"[" + name + "] is no longer a plugin but instead a module packaged with this distribution of Elasticsearch")));
305-
}
306-
307255
public void testRemoveWhenRemovingMarker() throws Exception {
308256
createPlugin("fake");
309257
Files.createFile(env.pluginsFile().resolve("fake").resolve("plugin.jar"));

0 commit comments

Comments
 (0)