|
|
@@ -19,22 +19,6 @@
|
|
|
|
|
|
package org.elasticsearch.plugins;
|
|
|
|
|
|
-import joptsimple.OptionSet;
|
|
|
-import joptsimple.OptionSpec;
|
|
|
-import org.apache.lucene.util.IOUtils;
|
|
|
-import org.elasticsearch.Build;
|
|
|
-import org.elasticsearch.Version;
|
|
|
-import org.elasticsearch.bootstrap.JarHell;
|
|
|
-import org.elasticsearch.cli.ExitCodes;
|
|
|
-import org.elasticsearch.cli.SettingCommand;
|
|
|
-import org.elasticsearch.cli.Terminal;
|
|
|
-import org.elasticsearch.cli.UserError;
|
|
|
-import org.elasticsearch.common.hash.MessageDigests;
|
|
|
-import org.elasticsearch.common.io.FileSystemUtils;
|
|
|
-import org.elasticsearch.common.settings.Settings;
|
|
|
-import org.elasticsearch.env.Environment;
|
|
|
-import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
|
|
-
|
|
|
import java.io.BufferedReader;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
@@ -55,18 +39,31 @@ import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashSet;
|
|
|
-import java.util.LinkedHashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Locale;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
import java.util.Set;
|
|
|
+import java.util.TreeSet;
|
|
|
import java.util.zip.ZipEntry;
|
|
|
import java.util.zip.ZipInputStream;
|
|
|
|
|
|
-import static java.util.Collections.unmodifiableSet;
|
|
|
+import joptsimple.OptionSet;
|
|
|
+import joptsimple.OptionSpec;
|
|
|
+import org.apache.lucene.util.IOUtils;
|
|
|
+import org.elasticsearch.Version;
|
|
|
+import org.elasticsearch.bootstrap.JarHell;
|
|
|
+import org.elasticsearch.cli.ExitCodes;
|
|
|
+import org.elasticsearch.cli.SettingCommand;
|
|
|
+import org.elasticsearch.cli.Terminal;
|
|
|
+import org.elasticsearch.cli.UserError;
|
|
|
+import org.elasticsearch.common.hash.MessageDigests;
|
|
|
+import org.elasticsearch.common.io.FileSystemUtils;
|
|
|
+import org.elasticsearch.common.settings.Settings;
|
|
|
+import org.elasticsearch.env.Environment;
|
|
|
+import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
|
|
+
|
|
|
import static org.elasticsearch.cli.Terminal.Verbosity.VERBOSE;
|
|
|
-import static org.elasticsearch.common.util.set.Sets.newHashSet;
|
|
|
|
|
|
/**
|
|
|
* A command for the plugin cli to install a plugin into elasticsearch.
|
|
|
@@ -102,37 +99,40 @@ class InstallPluginCommand extends SettingCommand {
|
|
|
|
|
|
private static final String PROPERTY_STAGING_ID = "es.plugins.staging";
|
|
|
|
|
|
- // TODO: make this a resource file generated by gradle
|
|
|
- static final Set<String> MODULES = unmodifiableSet(newHashSet(
|
|
|
- "ingest-grok",
|
|
|
- "lang-expression",
|
|
|
- "lang-groovy",
|
|
|
- "lang-painless",
|
|
|
- "reindex"));
|
|
|
-
|
|
|
- // TODO: make this a resource file generated by gradle
|
|
|
- static final Set<String> OFFICIAL_PLUGINS = unmodifiableSet(new LinkedHashSet<>(Arrays.asList(
|
|
|
- "analysis-icu",
|
|
|
- "analysis-kuromoji",
|
|
|
- "analysis-phonetic",
|
|
|
- "analysis-smartcn",
|
|
|
- "analysis-stempel",
|
|
|
- "discovery-azure",
|
|
|
- "discovery-ec2",
|
|
|
- "discovery-gce",
|
|
|
- "ingest-attachment",
|
|
|
- "ingest-geoip",
|
|
|
- "lang-javascript",
|
|
|
- "lang-python",
|
|
|
- "mapper-attachments",
|
|
|
- "mapper-murmur3",
|
|
|
- "mapper-size",
|
|
|
- "repository-azure",
|
|
|
- "repository-gcs",
|
|
|
- "repository-hdfs",
|
|
|
- "repository-s3",
|
|
|
- "store-smb",
|
|
|
- "x-pack")));
|
|
|
+ /** The builtin modules, which are plugins, but cannot be installed or removed. */
|
|
|
+ static final Set<String> MODULES;
|
|
|
+ static {
|
|
|
+ try (InputStream stream = InstallPluginCommand.class.getResourceAsStream("/modules.txt");
|
|
|
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) {
|
|
|
+ Set<String> modules = new HashSet<>();
|
|
|
+ String line = reader.readLine();
|
|
|
+ while (line != null) {
|
|
|
+ modules.add(line.trim());
|
|
|
+ line = reader.readLine();
|
|
|
+ }
|
|
|
+ MODULES = Collections.unmodifiableSet(modules);
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** The official plugins that can be installed simply by name. */
|
|
|
+ static final Set<String> OFFICIAL_PLUGINS;
|
|
|
+ static {
|
|
|
+ try (InputStream stream = InstallPluginCommand.class.getResourceAsStream("/plugins.txt");
|
|
|
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) {
|
|
|
+ Set<String> plugins = new TreeSet<>(); // use tree set to get sorting for help command
|
|
|
+ String line = reader.readLine();
|
|
|
+ while (line != null) {
|
|
|
+ plugins.add(line.trim());
|
|
|
+ line = reader.readLine();
|
|
|
+ }
|
|
|
+ plugins.add("x-pack");
|
|
|
+ OFFICIAL_PLUGINS = Collections.unmodifiableSet(plugins);
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
private final OptionSpec<Void> batchOption;
|
|
|
private final OptionSpec<String> arguments;
|