From fa5f7a7b8051edeaab9f441b2b0b15438de6dc8d Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Mon, 19 Mar 2018 13:22:06 -0700 Subject: [PATCH 1/2] Plugins: Fix module name conflict check for meta plugins This commit moves the check for plugin names conflicting with builtin modules to a location that also applies to meta plugins. --- .../elasticsearch/plugins/InstallPluginCommand.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java b/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java index b7f201b70aa46..0ce161ac9d1ec 100644 --- a/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java +++ b/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java @@ -532,6 +532,12 @@ private Path stagingDirectoryWithoutPosixPermissions(Path pluginsDir) throws IOE // checking for existing version of the plugin private void verifyPluginName(Path pluginPath, String pluginName, Path candidateDir) throws UserException, IOException { + // don't let luser install plugin conflicting with module... + // they might be unavoidably in maven central and are packaged up the same way) + if (MODULES.contains(pluginName)) { + throw new UserException(ExitCodes.USAGE, "plugin '" + pluginName + "' cannot be installed as a plugin, it is a system module"); + } + final Path destination = pluginPath.resolve(pluginName); if (Files.exists(destination)) { final String message = String.format( @@ -574,13 +580,6 @@ private PluginInfo loadPluginInfo(Terminal terminal, Path pluginRoot, boolean is terminal.println(VERBOSE, info.toString()); - // don't let user install plugin as a module... - // they might be unavoidably in maven central and are packaged up the same way) - if (MODULES.contains(info.getName())) { - throw new UserException(ExitCodes.USAGE, "plugin '" + info.getName() + - "' cannot be installed like this, it is a system module"); - } - // check for jar hell before any copying jarHellCheck(info, pluginRoot, env.pluginsFile(), env.modulesFile()); From 49977e90a5434d497e2062cd092f7388f50fc54f Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Mon, 19 Mar 2018 16:08:56 -0700 Subject: [PATCH 2/2] iter --- .../java/org/elasticsearch/plugins/InstallPluginCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java b/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java index 0ce161ac9d1ec..84f3764880243 100644 --- a/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java +++ b/distribution/tools/plugin-cli/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java @@ -532,7 +532,7 @@ private Path stagingDirectoryWithoutPosixPermissions(Path pluginsDir) throws IOE // checking for existing version of the plugin private void verifyPluginName(Path pluginPath, String pluginName, Path candidateDir) throws UserException, IOException { - // don't let luser install plugin conflicting with module... + // don't let user install plugin conflicting with module... // they might be unavoidably in maven central and are packaged up the same way) if (MODULES.contains(pluginName)) { throw new UserException(ExitCodes.USAGE, "plugin '" + pluginName + "' cannot be installed as a plugin, it is a system module");