don't let pluginmanager install modules

This commit is contained in:
Robert Muir 2015-12-03 23:36:02 -05:00
parent 208b46d94b
commit 763747df71
1 changed files with 10 additions and 2 deletions

View File

@ -66,6 +66,10 @@ public class PluginManager {
"plugin", "plugin",
"plugin.bat", "plugin.bat",
"service.bat")); "service.bat"));
static final Set<String> MODULES = unmodifiableSet(newHashSet(
"lang-expression",
"lang-groovy"));
static final Set<String> OFFICIAL_PLUGINS = unmodifiableSet(newHashSet( static final Set<String> OFFICIAL_PLUGINS = unmodifiableSet(newHashSet(
"analysis-icu", "analysis-icu",
@ -78,8 +82,6 @@ public class PluginManager {
"discovery-ec2", "discovery-ec2",
"discovery-gce", "discovery-gce",
"discovery-multicast", "discovery-multicast",
"lang-expression",
"lang-groovy",
"lang-javascript", "lang-javascript",
"lang-python", "lang-python",
"mapper-attachments", "mapper-attachments",
@ -221,6 +223,12 @@ public class PluginManager {
PluginInfo info = PluginInfo.readFromProperties(root); PluginInfo info = PluginInfo.readFromProperties(root);
terminal.println(VERBOSE, "%s", info); terminal.println(VERBOSE, "%s", info);
// don't let luser 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 IOException("plugin '" + info.getName() + "' cannot be installed like this, it is a system module");
}
// update name in handle based on 'name' property found in descriptor file // update name in handle based on 'name' property found in descriptor file
pluginHandle = new PluginHandle(info.getName(), pluginHandle.version, pluginHandle.user); pluginHandle = new PluginHandle(info.getName(), pluginHandle.version, pluginHandle.user);
final Path extractLocation = pluginHandle.extractedDir(environment); final Path extractLocation = pluginHandle.extractedDir(environment);