Skip to content

Commit 7112d43

Browse files
authored
Plugins: Fix module name conflict check for meta plugins (#29146)
This commit moves the check for plugin names conflicting with builtin modules to a location that also applies to meta plugins.
1 parent e582510 commit 7112d43

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,12 @@ private Path stagingDirectoryWithoutPosixPermissions(Path pluginsDir) throws IOE
532532

533533
// checking for existing version of the plugin
534534
private void verifyPluginName(Path pluginPath, String pluginName, Path candidateDir) throws UserException, IOException {
535+
// don't let user install plugin conflicting with module...
536+
// they might be unavoidably in maven central and are packaged up the same way)
537+
if (MODULES.contains(pluginName)) {
538+
throw new UserException(ExitCodes.USAGE, "plugin '" + pluginName + "' cannot be installed as a plugin, it is a system module");
539+
}
540+
535541
final Path destination = pluginPath.resolve(pluginName);
536542
if (Files.exists(destination)) {
537543
final String message = String.format(
@@ -574,13 +580,6 @@ private PluginInfo loadPluginInfo(Terminal terminal, Path pluginRoot, boolean is
574580

575581
terminal.println(VERBOSE, info.toString());
576582

577-
// don't let user install plugin as a module...
578-
// they might be unavoidably in maven central and are packaged up the same way)
579-
if (MODULES.contains(info.getName())) {
580-
throw new UserException(ExitCodes.USAGE, "plugin '" + info.getName() +
581-
"' cannot be installed like this, it is a system module");
582-
}
583-
584583
// check for jar hell before any copying
585584
jarHellCheck(info, pluginRoot, env.pluginsFile(), env.modulesFile());
586585

0 commit comments

Comments
 (0)