use of com.github.alexcojocaru.mojo.elasticsearch.v2.PluginConfiguration in project elasticsearch-maven-plugin by alexcojocaru.
the class InstallPluginsStep method execute.
@Override
public void execute(InstanceConfiguration config) {
if (config.getClusterConfiguration().getPlugins().size() > 0) {
if (VersionUtil.isEqualOrGreater_6_4_0(config.getClusterConfiguration().getVersion())) {
FilesystemUtil.setScriptPermission(config, "elasticsearch-cli");
}
FilesystemUtil.setScriptPermission(config, "elasticsearch-plugin");
}
Log log = config.getClusterConfiguration().getLog();
for (PluginConfiguration plugin : config.getClusterConfiguration().getPlugins()) {
log.info(String.format("Installing plugin '%s' with options '%s'", plugin.getUri(), plugin.getEsJavaOpts()));
Map<String, String> environment = new HashMap<>(config.getEnvironmentVariables());
if (StringUtils.isNotBlank(plugin.getEsJavaOpts())) {
environment.put("ES_JAVA_OPTS", plugin.getEsJavaOpts());
}
CommandLine cmd = ProcessUtil.buildCommandLine("bin/elasticsearch-plugin").addArgument("install").addArgument("--batch").addArgument(plugin.getUri());
ProcessUtil.executeScript(config, cmd, environment);
}
}
Aggregations