Merge branch 'master' into plugin_name_api
Original commit: elastic/x-pack-elasticsearch@ddc161e695
This commit is contained in:
commit
e985159f65
|
@ -14,7 +14,6 @@ import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.script.ScriptContextRegistry;
|
import org.elasticsearch.script.ScriptContextRegistry;
|
||||||
import org.elasticsearch.script.ScriptEngineRegistry;
|
import org.elasticsearch.script.ScriptEngineRegistry;
|
||||||
import org.elasticsearch.script.ScriptEngineService;
|
|
||||||
import org.elasticsearch.script.ScriptService;
|
import org.elasticsearch.script.ScriptService;
|
||||||
import org.elasticsearch.script.ScriptSettings;
|
import org.elasticsearch.script.ScriptSettings;
|
||||||
import org.elasticsearch.script.groovy.GroovyScriptEngineService;
|
import org.elasticsearch.script.groovy.GroovyScriptEngineService;
|
||||||
|
@ -25,8 +24,7 @@ import org.junit.Ignore;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Ignore // not a test.
|
@Ignore // not a test.
|
||||||
@SuppressForbidden(reason = "gradle is broken and tries to run me as a test")
|
@SuppressForbidden(reason = "gradle is broken and tries to run me as a test")
|
||||||
|
@ -38,19 +36,13 @@ public final class MessyTestUtils {
|
||||||
.put("path.home", LuceneTestCase.createTempDir())
|
.put("path.home", LuceneTestCase.createTempDir())
|
||||||
.build();
|
.build();
|
||||||
GroovyScriptEngineService groovyScriptEngineService = new GroovyScriptEngineService(settings);
|
GroovyScriptEngineService groovyScriptEngineService = new GroovyScriptEngineService(settings);
|
||||||
Set<ScriptEngineService> engineServiceSet = new HashSet<>();
|
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(Collections.singleton(groovyScriptEngineService));
|
||||||
engineServiceSet.add(groovyScriptEngineService);
|
|
||||||
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
|
||||||
Arrays.asList(
|
|
||||||
new ScriptEngineRegistry.ScriptEngineRegistration(GroovyScriptEngineService.class, GroovyScriptEngineService.NAME)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(Arrays.asList(ScriptServiceProxy.INSTANCE));
|
ScriptContextRegistry scriptContextRegistry = new ScriptContextRegistry(Arrays.asList(ScriptServiceProxy.INSTANCE));
|
||||||
|
|
||||||
ClusterService clusterService = Mockito.mock(ClusterService.class);
|
ClusterService clusterService = Mockito.mock(ClusterService.class);
|
||||||
Mockito.when(clusterService.state()).thenReturn(ClusterState.builder(new ClusterName("_name")).build());
|
Mockito.when(clusterService.state()).thenReturn(ClusterState.builder(new ClusterName("_name")).build());
|
||||||
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, scriptContextRegistry);
|
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, scriptContextRegistry);
|
||||||
return ScriptServiceProxy.of(new ScriptService(settings, new Environment(settings), engineServiceSet,
|
return ScriptServiceProxy.of(new ScriptService(settings, new Environment(settings),
|
||||||
new ResourceWatcherService(settings, tp), scriptEngineRegistry, scriptContextRegistry, scriptSettings),
|
new ResourceWatcherService(settings, tp), scriptEngineRegistry, scriptContextRegistry, scriptSettings),
|
||||||
clusterService);
|
clusterService);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,18 +49,14 @@ public class WatcherTemplateTests extends ESTestCase {
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
Settings setting = Settings.builder().put(ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING, true).build();
|
Settings setting = Settings.builder().put(ScriptService.SCRIPT_AUTO_RELOAD_ENABLED_SETTING, true).build();
|
||||||
Environment environment = Mockito.mock(Environment.class);
|
Environment environment = Mockito.mock(Environment.class);
|
||||||
Set<ScriptEngineService> engines = Collections.singleton(new MustacheScriptEngineService(setting));
|
|
||||||
ResourceWatcherService resourceWatcherService = Mockito.mock(ResourceWatcherService.class);
|
ResourceWatcherService resourceWatcherService = Mockito.mock(ResourceWatcherService.class);
|
||||||
ScriptContextRegistry registry = new ScriptContextRegistry(Collections.singletonList(ScriptServiceProxy.INSTANCE));
|
ScriptContextRegistry registry = new ScriptContextRegistry(Collections.singletonList(ScriptServiceProxy.INSTANCE));
|
||||||
|
|
||||||
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
ScriptEngineRegistry scriptEngineRegistry = new ScriptEngineRegistry(
|
||||||
Arrays.asList(
|
Collections.singleton(new MustacheScriptEngineService(setting))
|
||||||
new ScriptEngineRegistry.ScriptEngineRegistration(MustacheScriptEngineService.class,
|
|
||||||
MustacheScriptEngineService.NAME)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, registry);
|
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, registry);
|
||||||
ScriptService scriptService = new ScriptService(setting, environment, engines, resourceWatcherService, scriptEngineRegistry,
|
ScriptService scriptService = new ScriptService(setting, environment, resourceWatcherService, scriptEngineRegistry,
|
||||||
registry, scriptSettings);
|
registry, scriptSettings);
|
||||||
ClusterService clusterService = Mockito.mock(ClusterService.class);
|
ClusterService clusterService = Mockito.mock(ClusterService.class);
|
||||||
Mockito.when(clusterService.state()).thenReturn(ClusterState.builder(new ClusterName("_name")).build());
|
Mockito.when(clusterService.state()).thenReturn(ClusterState.builder(new ClusterName("_name")).build());
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.elasticsearch.xpack.graph.rest.action.RestGraphAction;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Graph extends Plugin {
|
public class Graph extends Plugin {
|
||||||
|
|
||||||
|
@ -61,8 +62,10 @@ public class Graph extends Plugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(SettingsModule module) {
|
|
||||||
module.registerSetting(Setting.boolSetting(XPackPlugin.featureEnabledSetting(NAME), true, Setting.Property.NodeScope));
|
@Override
|
||||||
|
public List<Setting<?>> getSettings() {
|
||||||
|
return Collections.singletonList(Setting.boolSetting(XPackPlugin.featureEnabledSetting(NAME), true, Setting.Property.NodeScope));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.elasticsearch.index.query.QueryBuilders;
|
||||||
import org.elasticsearch.index.query.ScriptQueryBuilder;
|
import org.elasticsearch.index.query.ScriptQueryBuilder;
|
||||||
import org.elasticsearch.marvel.Monitoring;
|
import org.elasticsearch.marvel.Monitoring;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
|
import org.elasticsearch.plugins.ScriptPlugin;
|
||||||
import org.elasticsearch.script.AbstractSearchScript;
|
import org.elasticsearch.script.AbstractSearchScript;
|
||||||
import org.elasticsearch.script.ExecutableScript;
|
import org.elasticsearch.script.ExecutableScript;
|
||||||
import org.elasticsearch.script.NativeScriptFactory;
|
import org.elasticsearch.script.NativeScriptFactory;
|
||||||
|
@ -34,6 +35,8 @@ import org.elasticsearch.xpack.graph.action.Vertex;
|
||||||
import org.elasticsearch.xpack.graph.action.VertexRequest;
|
import org.elasticsearch.xpack.graph.action.VertexRequest;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
|
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
|
||||||
|
@ -346,10 +349,10 @@ public class GraphTests extends ESSingleNodeTestCase {
|
||||||
assertThat(why, strongVertex.getWeight(), greaterThan(weakVertex.getWeight()));
|
assertThat(why, strongVertex.getWeight(), greaterThan(weakVertex.getWeight()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ScriptedTimeoutPlugin extends Plugin {
|
public static class ScriptedTimeoutPlugin extends Plugin implements ScriptPlugin {
|
||||||
|
@Override
|
||||||
public void onModule(ScriptModule module) {
|
public List<NativeScriptFactory> getNativeScripts() {
|
||||||
module.registerScript(NativeTestScriptedTimeout.TEST_NATIVE_SCRIPT_TIMEOUT, NativeTestScriptedTimeout.Factory.class);
|
return Collections.singletonList(new NativeTestScriptedTimeout.Factory());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,6 +371,11 @@ public class GraphTests extends ESSingleNodeTestCase {
|
||||||
public boolean needsScores() {
|
public boolean needsScores() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return TEST_NATIVE_SCRIPT_TIMEOUT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.license.plugin.rest.RestPutLicenseAction;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.xpack.XPackPlugin.isTribeClientNode;
|
import static org.elasticsearch.xpack.XPackPlugin.isTribeClientNode;
|
||||||
import static org.elasticsearch.xpack.XPackPlugin.isTribeNode;
|
import static org.elasticsearch.xpack.XPackPlugin.isTribeNode;
|
||||||
|
@ -80,8 +81,8 @@ public class Licensing {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(SettingsModule module) {
|
public List<Setting<?>> getSettings() {
|
||||||
// TODO convert this wildcard to a real setting
|
// TODO convert this wildcard to a real setting
|
||||||
module.registerSetting(Setting.groupSetting("license.", Setting.Property.NodeScope));
|
return Collections.singletonList(Setting.groupSetting("license.", Setting.Property.NodeScope));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,9 @@ import org.elasticsearch.common.settings.SettingsModule;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class TestConsumerPluginBase extends Plugin {
|
public abstract class TestConsumerPluginBase extends Plugin {
|
||||||
|
|
||||||
|
@ -33,13 +35,11 @@ public abstract class TestConsumerPluginBase extends Plugin {
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(SettingsModule module) {
|
@Override
|
||||||
try {
|
public List<Setting<?>> getSettings() {
|
||||||
module.registerSetting(Setting.simpleString("_trial_license_duration_in_seconds", Setting.Property.NodeScope));
|
return Arrays.asList(Setting.simpleString("_trial_license_duration_in_seconds", Setting.Property.NodeScope,
|
||||||
module.registerSetting(Setting.simpleString("_grace_duration_in_seconds", Setting.Property.NodeScope));
|
Setting.Property.Shared), Setting.simpleString("_grace_duration_in_seconds", Setting.Property.NodeScope,
|
||||||
} catch (IllegalArgumentException ex) {
|
Setting.Property.Shared));
|
||||||
// already loaded
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Class<? extends TestPluginServiceBase> service();
|
public abstract Class<? extends TestPluginServiceBase> service();
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.elasticsearch.action.ActionModule;
|
||||||
import org.elasticsearch.common.component.LifecycleComponent;
|
import org.elasticsearch.common.component.LifecycleComponent;
|
||||||
import org.elasticsearch.common.inject.Module;
|
import org.elasticsearch.common.inject.Module;
|
||||||
import org.elasticsearch.common.network.NetworkModule;
|
import org.elasticsearch.common.network.NetworkModule;
|
||||||
|
import org.elasticsearch.common.settings.Setting;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.settings.SettingsModule;
|
import org.elasticsearch.common.settings.SettingsModule;
|
||||||
import org.elasticsearch.marvel.action.MonitoringBulkAction;
|
import org.elasticsearch.marvel.action.MonitoringBulkAction;
|
||||||
|
@ -80,7 +81,6 @@ public class Monitoring {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(SettingsModule module) {
|
public void onModule(SettingsModule module) {
|
||||||
MonitoringSettings.register(module);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(ActionModule module) {
|
public void onModule(ActionModule module) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.elasticsearch.common.settings.SettingsModule;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.xpack.XPackPlugin;
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
@ -125,22 +126,23 @@ public class MonitoringSettings extends AbstractComponent {
|
||||||
public static final Setting<Settings> EXPORTERS_SETTINGS =
|
public static final Setting<Settings> EXPORTERS_SETTINGS =
|
||||||
groupSetting(key("agent.exporters."), Property.Dynamic, Property.NodeScope);
|
groupSetting(key("agent.exporters."), Property.Dynamic, Property.NodeScope);
|
||||||
|
|
||||||
static void register(SettingsModule module) {
|
public static List<Setting<?>> getSettings() {
|
||||||
module.registerSetting(INDICES);
|
return Arrays.asList(INDICES,
|
||||||
module.registerSetting(INTERVAL);
|
INTERVAL,
|
||||||
module.registerSetting(INDEX_RECOVERY_TIMEOUT);
|
INDEX_RECOVERY_TIMEOUT,
|
||||||
module.registerSetting(INDEX_STATS_TIMEOUT);
|
INDEX_STATS_TIMEOUT,
|
||||||
module.registerSetting(INDICES_STATS_TIMEOUT);
|
INDICES_STATS_TIMEOUT,
|
||||||
module.registerSetting(INDEX_RECOVERY_ACTIVE_ONLY);
|
INDEX_RECOVERY_ACTIVE_ONLY,
|
||||||
module.registerSetting(COLLECTORS);
|
COLLECTORS,
|
||||||
module.registerSetting(CLUSTER_STATE_TIMEOUT);
|
CLUSTER_STATE_TIMEOUT,
|
||||||
module.registerSetting(CLUSTER_STATS_TIMEOUT);
|
CLUSTER_STATS_TIMEOUT,
|
||||||
module.registerSetting(HISTORY_DURATION);
|
HISTORY_DURATION,
|
||||||
module.registerSetting(EXPORTERS_SETTINGS);
|
EXPORTERS_SETTINGS,
|
||||||
module.registerSetting(ENABLED);
|
ENABLED);
|
||||||
|
}
|
||||||
|
|
||||||
module.registerSettingsFilter("xpack.monitoring.agent.exporters.*.auth.*");
|
public static List<String> getSettingsFilter() {
|
||||||
module.registerSettingsFilter("xpack.monitoring.agent.exporters.*.ssl.*");
|
return Arrays.asList("xpack.monitoring.agent.exporters.*.auth.*", "xpack.monitoring.agent.exporters.*.ssl.*");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.elasticsearch.common.regex.Regex;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
import org.elasticsearch.common.settings.Setting;
|
||||||
import org.elasticsearch.common.settings.Setting.Property;
|
import org.elasticsearch.common.settings.Setting.Property;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.settings.SettingsModule;
|
|
||||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||||
import org.elasticsearch.index.IndexModule;
|
import org.elasticsearch.index.IndexModule;
|
||||||
import org.elasticsearch.shield.action.ShieldActionModule;
|
import org.elasticsearch.shield.action.ShieldActionModule;
|
||||||
|
@ -188,62 +187,70 @@ public class Security {
|
||||||
return settingsBuilder.build();
|
return settingsBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(SettingsModule settingsModule) {
|
public List<Setting<?>> getSettings() {
|
||||||
|
List<Setting<?>> settingsList = new ArrayList<>();
|
||||||
// always register for both client and node modes
|
// always register for both client and node modes
|
||||||
XPackPlugin.registerFeatureEnabledSettings(settingsModule, NAME, true);
|
XPackPlugin.addFeatureEnabledSettings(settingsList, NAME, true);
|
||||||
settingsModule.registerSetting(USER_SETTING);
|
settingsList.add(USER_SETTING);
|
||||||
|
|
||||||
// SSL settings
|
// SSL settings
|
||||||
SSLConfiguration.Global.registerSettings(settingsModule);
|
SSLConfiguration.Global.addSettings(settingsList);
|
||||||
|
|
||||||
// transport settings
|
// transport settings
|
||||||
ShieldNettyTransport.registerSettings(settingsModule);
|
ShieldNettyTransport.addSettings(settingsList);
|
||||||
|
|
||||||
if (transportClientMode) {
|
if (transportClientMode) {
|
||||||
return;
|
return settingsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following just apply in node mode
|
// The following just apply in node mode
|
||||||
XPackPlugin.registerFeatureEnabledSettings(settingsModule, DLS_FLS_FEATURE, true);
|
XPackPlugin.addFeatureEnabledSettings(settingsList, DLS_FLS_FEATURE, true);
|
||||||
|
|
||||||
// IP Filter settings
|
// IP Filter settings
|
||||||
IPFilter.registerSettings(settingsModule);
|
IPFilter.addSettings(settingsList);
|
||||||
|
|
||||||
// audit settings
|
// audit settings
|
||||||
AuditTrailModule.registerSettings(settingsModule);
|
AuditTrailModule.addSettings(settingsList);
|
||||||
|
|
||||||
// authentication settings
|
// authentication settings
|
||||||
FileRolesStore.registerSettings(settingsModule);
|
FileRolesStore.addSettings(settingsList);
|
||||||
AnonymousUser.registerSettings(settingsModule);
|
AnonymousUser.addSettings(settingsList);
|
||||||
Realms.registerSettings(settingsModule);
|
Realms.addSettings(settingsList);
|
||||||
NativeUsersStore.registerSettings(settingsModule);
|
NativeUsersStore.addSettings(settingsList);
|
||||||
NativeRolesStore.registerSettings(settingsModule);
|
NativeRolesStore.addSettings(settingsList);
|
||||||
InternalAuthenticationService.registerSettings(settingsModule);
|
InternalAuthenticationService.addSettings(settingsList);
|
||||||
InternalAuthorizationService.registerSettings(settingsModule);
|
InternalAuthorizationService.addSettings(settingsList);
|
||||||
|
|
||||||
// HTTP settings
|
// HTTP settings
|
||||||
ShieldNettyHttpServerTransport.registerSettings(settingsModule);
|
ShieldNettyHttpServerTransport.addSettings(settingsList);
|
||||||
|
|
||||||
// encryption settings
|
// encryption settings
|
||||||
InternalCryptoService.registerSettings(settingsModule);
|
InternalCryptoService.addSettings(settingsList);
|
||||||
|
|
||||||
// hide settings
|
// hide settings
|
||||||
settingsModule.registerSetting(Setting.listSetting(setting("hide_settings"), Collections.emptyList(), Function.identity(),
|
settingsList.add(Setting.listSetting(setting("hide_settings"), Collections.emptyList(), Function.identity(),
|
||||||
Property.NodeScope, Property.Filtered));
|
Property.NodeScope, Property.Filtered));
|
||||||
|
return settingsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> getSettingsFilter() {
|
||||||
|
ArrayList<String> settingsFilter = new ArrayList<>();
|
||||||
String[] asArray = settings.getAsArray(setting("hide_settings"));
|
String[] asArray = settings.getAsArray(setting("hide_settings"));
|
||||||
for (String pattern : asArray) {
|
for (String pattern : asArray) {
|
||||||
settingsModule.registerSettingsFilter(pattern);
|
settingsFilter.add(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsModule.registerSettingsFilter(setting("authc.realms.*.bind_dn"));
|
settingsFilter.add(setting("authc.realms.*.bind_dn"));
|
||||||
settingsModule.registerSettingsFilter(setting("authc.realms.*.bind_password"));
|
settingsFilter.add(setting("authc.realms.*.bind_password"));
|
||||||
settingsModule.registerSettingsFilter(setting("authc.realms.*." + SessionFactory.HOSTNAME_VERIFICATION_SETTING));
|
settingsFilter.add(setting("authc.realms.*." + SessionFactory.HOSTNAME_VERIFICATION_SETTING));
|
||||||
settingsModule.registerSettingsFilter(setting("authc.realms.*.truststore.password"));
|
settingsFilter.add(setting("authc.realms.*.truststore.password"));
|
||||||
settingsModule.registerSettingsFilter(setting("authc.realms.*.truststore.path"));
|
settingsFilter.add(setting("authc.realms.*.truststore.path"));
|
||||||
settingsModule.registerSettingsFilter(setting("authc.realms.*.truststore.algorithm"));
|
settingsFilter.add(setting("authc.realms.*.truststore.algorithm"));
|
||||||
|
|
||||||
// hide settings where we don't define them - they are part of a group...
|
// hide settings where we don't define them - they are part of a group...
|
||||||
settingsModule.registerSettingsFilter("transport.profiles.*." + setting("*"));
|
settingsFilter.add("transport.profiles.*." + setting("*"));
|
||||||
|
return settingsFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onIndexModule(IndexModule module) {
|
public void onIndexModule(IndexModule module) {
|
||||||
|
|
|
@ -102,10 +102,10 @@ public class AuditTrailModule extends AbstractShieldModule.Node {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(ENABLED_SETTING);
|
settings.add(ENABLED_SETTING);
|
||||||
settingsModule.registerSetting(OUTPUTS_SETTING);
|
settings.add(OUTPUTS_SETTING);
|
||||||
LoggingAuditTrail.registerSettings(settingsModule);
|
LoggingAuditTrail.registerSettings(settings);
|
||||||
IndexAuditTrail.registerSettings(settingsModule);
|
IndexAuditTrail.registerSettings(settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -877,15 +877,15 @@ public class IndexAuditTrail extends AbstractComponent implements AuditTrail, Cl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void registerSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(INDEX_SETTINGS);
|
settings.add(INDEX_SETTINGS);
|
||||||
settingsModule.registerSetting(EXCLUDE_EVENT_SETTINGS);
|
settings.add(EXCLUDE_EVENT_SETTINGS);
|
||||||
settingsModule.registerSetting(INCLUDE_EVENT_SETTINGS);
|
settings.add(INCLUDE_EVENT_SETTINGS);
|
||||||
settingsModule.registerSetting(ROLLOVER_SETTING);
|
settings.add(ROLLOVER_SETTING);
|
||||||
settingsModule.registerSetting(BULK_SIZE_SETTING);
|
settings.add(BULK_SIZE_SETTING);
|
||||||
settingsModule.registerSetting(FLUSH_TIMEOUT_SETTING);
|
settings.add(FLUSH_TIMEOUT_SETTING);
|
||||||
settingsModule.registerSetting(QUEUE_SIZE_SETTING);
|
settings.add(QUEUE_SIZE_SETTING);
|
||||||
settingsModule.registerSetting(REMOTE_CLIENT_SETTINGS);
|
settings.add(REMOTE_CLIENT_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class QueueConsumer extends Thread {
|
private class QueueConsumer extends Thread {
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.elasticsearch.transport.TransportMessage;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.common.Strings.arrayToCommaDelimitedString;
|
import static org.elasticsearch.common.Strings.arrayToCommaDelimitedString;
|
||||||
import static org.elasticsearch.shield.audit.AuditUtil.indices;
|
import static org.elasticsearch.shield.audit.AuditUtil.indices;
|
||||||
|
@ -463,9 +464,9 @@ public class LoggingAuditTrail extends AbstractLifecycleComponent<LoggingAuditTr
|
||||||
return builder.append(user.principal()).append("]").toString();
|
return builder.append(user.principal()).append("]").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void registerSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(HOST_ADDRESS_SETTING);
|
settings.add(HOST_ADDRESS_SETTING);
|
||||||
settingsModule.registerSetting(HOST_NAME_SETTING);
|
settings.add(HOST_NAME_SETTING);
|
||||||
settingsModule.registerSetting(NODE_NAME_SETTING);
|
settings.add(NODE_NAME_SETTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.elasticsearch.transport.TransportMessage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.shield.Security.setting;
|
import static org.elasticsearch.shield.Security.setting;
|
||||||
import static org.elasticsearch.shield.support.Exceptions.authenticationError;
|
import static org.elasticsearch.shield.support.Exceptions.authenticationError;
|
||||||
|
@ -316,9 +317,9 @@ public class InternalAuthenticationService extends AbstractComponent implements
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(SIGN_USER_HEADER);
|
settings.add(SIGN_USER_HEADER);
|
||||||
settingsModule.registerSetting(RUN_AS_ENABLED);
|
settings.add(RUN_AS_ENABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// these methods are package private for testing. They are also needed so that a AuditableRequest can be created in tests
|
// these methods are package private for testing. They are also needed so that a AuditableRequest can be created in tests
|
||||||
|
|
|
@ -212,7 +212,7 @@ public class Realms extends AbstractLifecycleComponent<Realms> implements Iterab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settingsModule) {
|
||||||
settingsModule.registerSetting(REALMS_GROUPS_SETTINGS);
|
settingsModule.add(REALMS_GROUPS_SETTINGS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -867,9 +867,9 @@ public class NativeUsersStore extends AbstractComponent implements ClusterStateL
|
||||||
void onUsersChanged(List<String> username);
|
void onUsersChanged(List<String> username);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(SCROLL_SIZE_SETTING);
|
settings.add(SCROLL_SIZE_SETTING);
|
||||||
settingsModule.registerSetting(SCROLL_KEEP_ALIVE_SETTING);
|
settings.add(SCROLL_KEEP_ALIVE_SETTING);
|
||||||
settingsModule.registerSetting(POLL_INTERVAL_SETTING);
|
settings.add(POLL_INTERVAL_SETTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,7 +357,7 @@ public class InternalAuthorizationService extends AbstractComponent implements A
|
||||||
return authorizationError("action [{}] is unauthorized for user [{}]", action, user.principal());
|
return authorizationError("action [{}] is unauthorized for user [{}]", action, user.principal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(ANONYMOUS_AUTHORIZATION_EXCEPTION_SETTING);
|
settings.add(ANONYMOUS_AUTHORIZATION_EXCEPTION_SETTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ public class FileRolesStore extends AbstractLifecycleComponent<RolesStore> imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(ROLES_FILE_SETTING);
|
settings.add(ROLES_FILE_SETTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.common.inject.Provider;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
import org.elasticsearch.common.settings.Setting;
|
||||||
import org.elasticsearch.common.settings.Setting.Property;
|
import org.elasticsearch.common.settings.Setting.Property;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.settings.SettingsModule;
|
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
|
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
|
@ -604,9 +603,9 @@ public class NativeRolesStore extends AbstractComponent implements RolesStore, C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(SCROLL_SIZE_SETTING);
|
settings.add(SCROLL_SIZE_SETTING);
|
||||||
settingsModule.registerSetting(SCROLL_KEEP_ALIVE_SETTING);
|
settings.add(SCROLL_KEEP_ALIVE_SETTING);
|
||||||
settingsModule.registerSetting(POLL_INTERVAL_SETTING);
|
settings.add(POLL_INTERVAL_SETTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -676,10 +676,10 @@ public class InternalCryptoService extends AbstractLifecycleComponent<InternalCr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(FILE_SETTING);
|
settings.add(FILE_SETTING);
|
||||||
settingsModule.registerSetting(ENCRYPTION_KEY_LENGTH_SETTING);
|
settings.add(ENCRYPTION_KEY_LENGTH_SETTING);
|
||||||
settingsModule.registerSetting(ENCRYPTION_KEY_ALGO_SETTING);
|
settings.add(ENCRYPTION_KEY_ALGO_SETTING);
|
||||||
settingsModule.registerSetting(ENCRYPTION_ALGO_SETTING);
|
settings.add(ENCRYPTION_ALGO_SETTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,25 +147,25 @@ public abstract class SSLConfiguration {
|
||||||
static final Setting<Boolean> INCLUDE_JDK_CERTS_SETTING = Setting.boolSetting(globalKey(Custom.INCLUDE_JDK_CERTS_SETTING), true,
|
static final Setting<Boolean> INCLUDE_JDK_CERTS_SETTING = Setting.boolSetting(globalKey(Custom.INCLUDE_JDK_CERTS_SETTING), true,
|
||||||
Property.NodeScope, Property.Filtered);
|
Property.NodeScope, Property.Filtered);
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(Global.CIPHERS_SETTING);
|
settings.add(Global.CIPHERS_SETTING);
|
||||||
settingsModule.registerSetting(Global.SUPPORTED_PROTOCOLS_SETTING);
|
settings.add(Global.SUPPORTED_PROTOCOLS_SETTING);
|
||||||
settingsModule.registerSetting(Global.KEYSTORE_PATH_SETTING);
|
settings.add(Global.KEYSTORE_PATH_SETTING);
|
||||||
settingsModule.registerSetting(Global.KEYSTORE_PASSWORD_SETTING);
|
settings.add(Global.KEYSTORE_PASSWORD_SETTING);
|
||||||
settingsModule.registerSetting(Global.KEYSTORE_ALGORITHM_SETTING);
|
settings.add(Global.KEYSTORE_ALGORITHM_SETTING);
|
||||||
settingsModule.registerSetting(Global.KEYSTORE_KEY_PASSWORD_SETTING);
|
settings.add(Global.KEYSTORE_KEY_PASSWORD_SETTING);
|
||||||
settingsModule.registerSetting(Global.KEY_PATH_SETTING);
|
settings.add(Global.KEY_PATH_SETTING);
|
||||||
settingsModule.registerSetting(Global.KEY_PASSWORD_SETTING);
|
settings.add(Global.KEY_PASSWORD_SETTING);
|
||||||
settingsModule.registerSetting(Global.CERT_SETTING);
|
settings.add(Global.CERT_SETTING);
|
||||||
settingsModule.registerSetting(Global.TRUSTSTORE_PATH_SETTING);
|
settings.add(Global.TRUSTSTORE_PATH_SETTING);
|
||||||
settingsModule.registerSetting(Global.TRUSTSTORE_PASSWORD_SETTING);
|
settings.add(Global.TRUSTSTORE_PASSWORD_SETTING);
|
||||||
settingsModule.registerSetting(Global.TRUSTSTORE_ALGORITHM_SETTING);
|
settings.add(Global.TRUSTSTORE_ALGORITHM_SETTING);
|
||||||
settingsModule.registerSetting(Global.PROTOCOL_SETTING);
|
settings.add(Global.PROTOCOL_SETTING);
|
||||||
settingsModule.registerSetting(Global.SESSION_CACHE_SIZE_SETTING);
|
settings.add(Global.SESSION_CACHE_SIZE_SETTING);
|
||||||
settingsModule.registerSetting(Global.SESSION_CACHE_TIMEOUT_SETTING);
|
settings.add(Global.SESSION_CACHE_TIMEOUT_SETTING);
|
||||||
settingsModule.registerSetting(Global.CA_PATHS_SETTING);
|
settings.add(Global.CA_PATHS_SETTING);
|
||||||
settingsModule.registerSetting(Global.INCLUDE_JDK_CERTS_SETTING);
|
settings.add(Global.INCLUDE_JDK_CERTS_SETTING);
|
||||||
settingsModule.registerSetting(Global.RELOAD_ENABLED_SETTING);
|
settings.add(Global.RELOAD_ENABLED_SETTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final KeyConfig keyConfig;
|
private final KeyConfig keyConfig;
|
||||||
|
|
|
@ -260,13 +260,13 @@ public class IPFilter {
|
||||||
updateRules();
|
updateRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(ALLOW_BOUND_ADDRESSES_SETTING);
|
settings.add(ALLOW_BOUND_ADDRESSES_SETTING);
|
||||||
settingsModule.registerSetting(IP_FILTER_ENABLED_SETTING);
|
settings.add(IP_FILTER_ENABLED_SETTING);
|
||||||
settingsModule.registerSetting(IP_FILTER_ENABLED_HTTP_SETTING);
|
settings.add(IP_FILTER_ENABLED_HTTP_SETTING);
|
||||||
settingsModule.registerSetting(HTTP_FILTER_ALLOW_SETTING);
|
settings.add(HTTP_FILTER_ALLOW_SETTING);
|
||||||
settingsModule.registerSetting(HTTP_FILTER_DENY_SETTING);
|
settings.add(HTTP_FILTER_DENY_SETTING);
|
||||||
settingsModule.registerSetting(TRANSPORT_FILTER_ALLOW_SETTING);
|
settings.add(TRANSPORT_FILTER_ALLOW_SETTING);
|
||||||
settingsModule.registerSetting(TRANSPORT_FILTER_DENY_SETTING);
|
settings.add(TRANSPORT_FILTER_DENY_SETTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.jboss.netty.handler.ssl.SslHandler;
|
||||||
import javax.net.ssl.SSLEngine;
|
import javax.net.ssl.SSLEngine;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION;
|
import static org.elasticsearch.http.HttpTransportSettings.SETTING_HTTP_COMPRESSION;
|
||||||
import static org.elasticsearch.shield.Security.setting;
|
import static org.elasticsearch.shield.Security.setting;
|
||||||
|
@ -128,10 +129,10 @@ public class ShieldNettyHttpServerTransport extends NettyHttpServerTransport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settings) {
|
||||||
settingsModule.registerSetting(SSL_SETTING);
|
settings.add(SSL_SETTING);
|
||||||
settingsModule.registerSetting(CLIENT_AUTH_SETTING);
|
settings.add(CLIENT_AUTH_SETTING);
|
||||||
settingsModule.registerSetting(DEPRECATED_SSL_SETTING);
|
settings.add(DEPRECATED_SSL_SETTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void overrideSettings(Settings.Builder settingsBuilder, Settings settings) {
|
public static void overrideSettings(Settings.Builder settingsBuilder, Settings settings) {
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.jboss.netty.handler.ssl.SslHandler;
|
||||||
import javax.net.ssl.SSLEngine;
|
import javax.net.ssl.SSLEngine;
|
||||||
import javax.net.ssl.SSLParameters;
|
import javax.net.ssl.SSLParameters;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.shield.Security.featureEnabledSetting;
|
import static org.elasticsearch.shield.Security.featureEnabledSetting;
|
||||||
import static org.elasticsearch.shield.Security.setting;
|
import static org.elasticsearch.shield.Security.setting;
|
||||||
|
@ -249,17 +250,17 @@ public class ShieldNettyTransport extends NettyTransport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static void addSettings(List<Setting<?>> settingsModule) {
|
||||||
settingsModule.registerSetting(SSL_SETTING);
|
settingsModule.add(SSL_SETTING);
|
||||||
settingsModule.registerSetting(HOSTNAME_VERIFICATION_SETTING);
|
settingsModule.add(HOSTNAME_VERIFICATION_SETTING);
|
||||||
settingsModule.registerSetting(HOSTNAME_VERIFICATION_RESOLVE_NAME_SETTING);
|
settingsModule.add(HOSTNAME_VERIFICATION_RESOLVE_NAME_SETTING);
|
||||||
settingsModule.registerSetting(CLIENT_AUTH_SETTING);
|
settingsModule.add(CLIENT_AUTH_SETTING);
|
||||||
settingsModule.registerSetting(PROFILE_SSL_SETTING);
|
settingsModule.add(PROFILE_SSL_SETTING);
|
||||||
settingsModule.registerSetting(PROFILE_CLIENT_AUTH_SETTING);
|
settingsModule.add(PROFILE_CLIENT_AUTH_SETTING);
|
||||||
|
|
||||||
// deprecated transport settings
|
// deprecated transport settings
|
||||||
settingsModule.registerSetting(DEPRECATED_SSL_SETTING);
|
settingsModule.add(DEPRECATED_SSL_SETTING);
|
||||||
settingsModule.registerSetting(DEPRECATED_PROFILE_SSL_SETTING);
|
settingsModule.add(DEPRECATED_PROFILE_SSL_SETTING);
|
||||||
settingsModule.registerSetting(DEPRECATED_HOSTNAME_VERIFICATION_SETTING);
|
settingsModule.add(DEPRECATED_HOSTNAME_VERIFICATION_SETTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.settings.SettingsModule;
|
import org.elasticsearch.common.settings.SettingsModule;
|
||||||
import org.elasticsearch.shield.user.User.ReservedUser;
|
import org.elasticsearch.shield.user.User.ReservedUser;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -80,8 +81,12 @@ public class AnonymousUser extends ReservedUser {
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerSettings(SettingsModule settingsModule) {
|
public static List<Setting<?>> getSettings() {
|
||||||
settingsModule.registerSetting(USERNAME_SETTING);
|
return Arrays.asList();
|
||||||
settingsModule.registerSetting(ROLES_SETTING);
|
}
|
||||||
|
|
||||||
|
public static void addSettings(List<Setting<?>> settingsList) {
|
||||||
|
settingsList.add(USERNAME_SETTING);
|
||||||
|
settingsList.add(ROLES_SETTING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,15 +11,14 @@ import org.elasticsearch.common.inject.Injector;
|
||||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||||
import org.elasticsearch.common.network.NetworkModule;
|
import org.elasticsearch.common.network.NetworkModule;
|
||||||
import org.elasticsearch.common.network.NetworkService;
|
import org.elasticsearch.common.network.NetworkService;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.settings.SettingsModule;
|
import org.elasticsearch.common.settings.SettingsModule;
|
||||||
import org.elasticsearch.indices.breaker.CircuitBreakerModule;
|
import org.elasticsearch.indices.breaker.CircuitBreakerService;
|
||||||
|
import org.elasticsearch.node.Node;
|
||||||
import org.elasticsearch.shield.audit.logfile.LoggingAuditTrail;
|
import org.elasticsearch.shield.audit.logfile.LoggingAuditTrail;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.threadpool.TestThreadPool;
|
import org.elasticsearch.threadpool.TestThreadPool;
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.threadpool.ThreadPoolModule;
|
|
||||||
import org.elasticsearch.transport.Transport;
|
import org.elasticsearch.transport.Transport;
|
||||||
import org.elasticsearch.transport.local.LocalTransport;
|
import org.elasticsearch.transport.local.LocalTransport;
|
||||||
|
|
||||||
|
@ -36,8 +35,7 @@ public class AuditTrailModuleTests extends ESTestCase {
|
||||||
.put("client.type", "node")
|
.put("client.type", "node")
|
||||||
.put(AuditTrailModule.ENABLED_SETTING.getKey(), false)
|
.put(AuditTrailModule.ENABLED_SETTING.getKey(), false)
|
||||||
.build();
|
.build();
|
||||||
SettingsModule settingsModule = new SettingsModule(settings);
|
SettingsModule settingsModule = new SettingsModule(settings, AuditTrailModule.ENABLED_SETTING);
|
||||||
settingsModule.registerSetting(AuditTrailModule.ENABLED_SETTING);
|
|
||||||
Injector injector = Guice.createInjector(settingsModule, new AuditTrailModule(settings));
|
Injector injector = Guice.createInjector(settingsModule, new AuditTrailModule(settings));
|
||||||
AuditTrail auditTrail = injector.getInstance(AuditTrail.class);
|
AuditTrail auditTrail = injector.getInstance(AuditTrail.class);
|
||||||
assertThat(auditTrail, is(AuditTrail.NOOP));
|
assertThat(auditTrail, is(AuditTrail.NOOP));
|
||||||
|
@ -58,8 +56,7 @@ public class AuditTrailModuleTests extends ESTestCase {
|
||||||
.build();
|
.build();
|
||||||
ThreadPool pool = new TestThreadPool("testLogFile");
|
ThreadPool pool = new TestThreadPool("testLogFile");
|
||||||
try {
|
try {
|
||||||
SettingsModule settingsModule = new SettingsModule(settings);
|
SettingsModule settingsModule = new SettingsModule(settings, AuditTrailModule.ENABLED_SETTING);
|
||||||
settingsModule.registerSetting(AuditTrailModule.ENABLED_SETTING);
|
|
||||||
Injector injector = Guice.createInjector(
|
Injector injector = Guice.createInjector(
|
||||||
settingsModule,
|
settingsModule,
|
||||||
new NetworkModule(new NetworkService(settings), settings, false, new NamedWriteableRegistry()) {
|
new NetworkModule(new NetworkService(settings), settings, false, new NamedWriteableRegistry()) {
|
||||||
|
@ -69,8 +66,11 @@ public class AuditTrailModuleTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new AuditTrailModule(settings),
|
new AuditTrailModule(settings),
|
||||||
new CircuitBreakerModule(settings),
|
b -> {
|
||||||
new ThreadPoolModule(pool),
|
b.bind(CircuitBreakerService.class).toInstance(Node.createCircuitBreakerService(settingsModule.getSettings(),
|
||||||
|
settingsModule.getClusterSettings()));
|
||||||
|
b.bind(ThreadPool.class).toInstance(pool);
|
||||||
|
},
|
||||||
new Version.Module(Version.CURRENT)
|
new Version.Module(Version.CURRENT)
|
||||||
);
|
);
|
||||||
AuditTrail auditTrail = injector.getInstance(AuditTrail.class);
|
AuditTrail auditTrail = injector.getInstance(AuditTrail.class);
|
||||||
|
@ -90,9 +90,7 @@ public class AuditTrailModuleTests extends ESTestCase {
|
||||||
.put(AuditTrailModule.OUTPUTS_SETTING.getKey() , "foo")
|
.put(AuditTrailModule.OUTPUTS_SETTING.getKey() , "foo")
|
||||||
.put("client.type", "node")
|
.put("client.type", "node")
|
||||||
.build();
|
.build();
|
||||||
SettingsModule settingsModule = new SettingsModule(settings);
|
SettingsModule settingsModule = new SettingsModule(settings, AuditTrailModule.ENABLED_SETTING, AuditTrailModule.OUTPUTS_SETTING);
|
||||||
settingsModule.registerSetting(AuditTrailModule.ENABLED_SETTING);
|
|
||||||
settingsModule.registerSetting(AuditTrailModule.OUTPUTS_SETTING);
|
|
||||||
try {
|
try {
|
||||||
Guice.createInjector(settingsModule, new AuditTrailModule(settings));
|
Guice.createInjector(settingsModule, new AuditTrailModule(settings));
|
||||||
fail("Expect initialization to fail when an unknown audit trail output is configured");
|
fail("Expect initialization to fail when an unknown audit trail output is configured");
|
||||||
|
|
|
@ -15,7 +15,9 @@ import org.elasticsearch.shield.ssl.SSLConfiguration;
|
||||||
import org.elasticsearch.xpack.XPackPlugin;
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matcher;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.nullValue;
|
import static org.hamcrest.CoreMatchers.nullValue;
|
||||||
|
@ -85,13 +87,14 @@ public class SettingsFilterTests extends ESTestCase {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
XPackPlugin xPackPlugin = new XPackPlugin(settings);
|
XPackPlugin xPackPlugin = new XPackPlugin(settings);
|
||||||
SettingsModule settingsModule = new SettingsModule(settings);
|
List<Setting<?>> settingList = new ArrayList<>();
|
||||||
|
settingList.add(Setting.simpleString("foo.bar", Setting.Property.NodeScope));
|
||||||
|
settingList.add(Setting.simpleString("foo.baz", Setting.Property.NodeScope));
|
||||||
|
settingList.add(Setting.simpleString("bar.baz", Setting.Property.NodeScope));
|
||||||
|
settingList.add(Setting.simpleString("baz.foo", Setting.Property.NodeScope));
|
||||||
|
settingList.addAll(xPackPlugin.getSettings());
|
||||||
// custom settings, potentially added by a plugin
|
// custom settings, potentially added by a plugin
|
||||||
settingsModule.registerSetting(Setting.simpleString("foo.bar", Setting.Property.NodeScope));
|
SettingsModule settingsModule = new SettingsModule(settings, settingList, xPackPlugin.getSettingsFilter());
|
||||||
settingsModule.registerSetting(Setting.simpleString("foo.baz", Setting.Property.NodeScope));
|
|
||||||
settingsModule.registerSetting(Setting.simpleString("bar.baz", Setting.Property.NodeScope));
|
|
||||||
settingsModule.registerSetting(Setting.simpleString("baz.foo", Setting.Property.NodeScope));
|
|
||||||
xPackPlugin.onModule(settingsModule);
|
|
||||||
|
|
||||||
Injector injector = Guice.createInjector(settingsModule);
|
Injector injector = Guice.createInjector(settingsModule);
|
||||||
SettingsFilter settingsFilter = injector.getInstance(SettingsFilter.class);
|
SettingsFilter settingsFilter = injector.getInstance(SettingsFilter.class);
|
||||||
|
|
|
@ -21,16 +21,19 @@ import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.IndexModule;
|
import org.elasticsearch.index.IndexModule;
|
||||||
import org.elasticsearch.license.plugin.Licensing;
|
import org.elasticsearch.license.plugin.Licensing;
|
||||||
import org.elasticsearch.marvel.Monitoring;
|
import org.elasticsearch.marvel.Monitoring;
|
||||||
|
import org.elasticsearch.marvel.MonitoringSettings;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
|
import org.elasticsearch.plugins.ScriptPlugin;
|
||||||
|
import org.elasticsearch.script.ScriptContext;
|
||||||
import org.elasticsearch.script.ScriptModule;
|
import org.elasticsearch.script.ScriptModule;
|
||||||
import org.elasticsearch.shield.Security;
|
import org.elasticsearch.shield.Security;
|
||||||
import org.elasticsearch.shield.authc.AuthenticationModule;
|
import org.elasticsearch.shield.authc.AuthenticationModule;
|
||||||
import org.elasticsearch.threadpool.ExecutorBuilder;
|
import org.elasticsearch.threadpool.ExecutorBuilder;
|
||||||
import org.elasticsearch.threadpool.ThreadPoolModule;
|
|
||||||
import org.elasticsearch.xpack.action.TransportXPackInfoAction;
|
import org.elasticsearch.xpack.action.TransportXPackInfoAction;
|
||||||
import org.elasticsearch.xpack.action.TransportXPackUsageAction;
|
import org.elasticsearch.xpack.action.TransportXPackUsageAction;
|
||||||
import org.elasticsearch.xpack.action.XPackInfoAction;
|
import org.elasticsearch.xpack.action.XPackInfoAction;
|
||||||
import org.elasticsearch.xpack.action.XPackUsageAction;
|
import org.elasticsearch.xpack.action.XPackUsageAction;
|
||||||
|
import org.elasticsearch.xpack.common.ScriptServiceProxy;
|
||||||
import org.elasticsearch.xpack.common.http.HttpClientModule;
|
import org.elasticsearch.xpack.common.http.HttpClientModule;
|
||||||
import org.elasticsearch.xpack.common.init.LazyInitializationModule;
|
import org.elasticsearch.xpack.common.init.LazyInitializationModule;
|
||||||
import org.elasticsearch.xpack.common.init.LazyInitializationService;
|
import org.elasticsearch.xpack.common.init.LazyInitializationService;
|
||||||
|
@ -55,7 +58,7 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class XPackPlugin extends Plugin {
|
public class XPackPlugin extends Plugin implements ScriptPlugin {
|
||||||
|
|
||||||
public static final String NAME = "x-pack";
|
public static final String NAME = "x-pack";
|
||||||
|
|
||||||
|
@ -174,26 +177,39 @@ public class XPackPlugin extends Plugin {
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(ScriptModule module) {
|
@Override
|
||||||
watcher.onModule(module);
|
public ScriptContext.Plugin getCustomScriptContexts() {
|
||||||
|
return ScriptServiceProxy.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(SettingsModule module) {
|
@Override
|
||||||
|
public List<Setting<?>> getSettings() {
|
||||||
|
ArrayList<Setting<?>> settings = new ArrayList<>();
|
||||||
|
settings.addAll(notification.getSettings());
|
||||||
|
settings.addAll(security.getSettings());
|
||||||
|
settings.addAll(MonitoringSettings.getSettings());
|
||||||
|
settings.addAll(watcher.getSettings());
|
||||||
|
settings.addAll(graph.getSettings());
|
||||||
|
settings.addAll(licensing.getSettings());
|
||||||
// we add the `xpack.version` setting to all internal indices
|
// we add the `xpack.version` setting to all internal indices
|
||||||
module.registerSetting(Setting.simpleString("index.xpack.version", Setting.Property.IndexScope));
|
settings.add(Setting.simpleString("index.xpack.version", Setting.Property.IndexScope));
|
||||||
|
|
||||||
// http settings
|
// http settings
|
||||||
module.registerSetting(Setting.simpleString("xpack.http.default_read_timeout", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.http.default_read_timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.http.default_connection_timeout", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.http.default_connection_timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.groupSetting("xpack.http.ssl.", Setting.Property.NodeScope));
|
settings.add(Setting.groupSetting("xpack.http.ssl.", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.groupSetting("xpack.http.proxy.", Setting.Property.NodeScope));
|
settings.add(Setting.groupSetting("xpack.http.proxy.", Setting.Property.NodeScope));
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
notification.onModule(module);
|
@Override
|
||||||
security.onModule(module);
|
public List<String> getSettingsFilter() {
|
||||||
monitoring.onModule(module);
|
List<String> filters = new ArrayList<>();
|
||||||
watcher.onModule(module);
|
filters.addAll(notification.getSettingsFilter());
|
||||||
graph.onModule(module);
|
filters.addAll(security.getSettingsFilter());
|
||||||
licensing.onModule(module);
|
filters.addAll(MonitoringSettings.getSettingsFilter());
|
||||||
|
filters.addAll(graph.getSettingsFilter());
|
||||||
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -297,9 +313,9 @@ public class XPackPlugin extends Plugin {
|
||||||
*
|
*
|
||||||
* {@code "<feature>.enabled": true | false}
|
* {@code "<feature>.enabled": true | false}
|
||||||
*/
|
*/
|
||||||
public static void registerFeatureEnabledSettings(SettingsModule settingsModule, String featureName, boolean defaultValue) {
|
public static void addFeatureEnabledSettings(List<Setting<?>> settingsList, String featureName, boolean defaultValue) {
|
||||||
settingsModule.registerSetting(Setting.boolSetting(featureEnabledSetting(featureName), defaultValue, Setting.Property.NodeScope));
|
settingsList.add(Setting.boolSetting(featureEnabledSetting(featureName), defaultValue, Setting.Property.NodeScope));
|
||||||
settingsModule.registerSetting(Setting.boolSetting(legacyFeatureEnabledSetting(featureName),
|
settingsList.add(Setting.boolSetting(legacyFeatureEnabledSetting(featureName),
|
||||||
defaultValue, Setting.Property.NodeScope));
|
defaultValue, Setting.Property.NodeScope));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,18 +36,22 @@ public class Notification {
|
||||||
this.transportClient = "transport".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
this.transportClient = "transport".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(SettingsModule module) {
|
public List<Setting<?>> getSettings() {
|
||||||
module.registerSetting(InternalSlackService.SLACK_ACCOUNT_SETTING);
|
return Arrays.asList(InternalSlackService.SLACK_ACCOUNT_SETTING,
|
||||||
module.registerSetting(InternalEmailService.EMAIL_ACCOUNT_SETTING);
|
InternalEmailService.EMAIL_ACCOUNT_SETTING,
|
||||||
module.registerSetting(InternalHipChatService.HIPCHAT_ACCOUNT_SETTING);
|
InternalHipChatService.HIPCHAT_ACCOUNT_SETTING,
|
||||||
module.registerSetting(InternalPagerDutyService.PAGERDUTY_ACCOUNT_SETTING);
|
InternalPagerDutyService.PAGERDUTY_ACCOUNT_SETTING);
|
||||||
|
}
|
||||||
|
|
||||||
module.registerSettingsFilter("xpack.notification.email.account.*.smtp.password");
|
public List<String> getSettingsFilter() {
|
||||||
module.registerSettingsFilter("xpack.notification.slack.account.*.url");
|
ArrayList<String> settingsFilter = new ArrayList<>();
|
||||||
module.registerSettingsFilter("xpack.notification.pagerduty.account.*.url");
|
settingsFilter.add("xpack.notification.email.account.*.smtp.password");
|
||||||
module.registerSettingsFilter("xpack.notification.pagerduty." + PagerDutyAccount.SERVICE_KEY_SETTING);
|
settingsFilter.add("xpack.notification.slack.account.*.url");
|
||||||
module.registerSettingsFilter("xpack.notification.pagerduty.account.*." + PagerDutyAccount.SERVICE_KEY_SETTING);
|
settingsFilter.add("xpack.notification.pagerduty.account.*.url");
|
||||||
module.registerSettingsFilter("xpack.notification.hipchat.account.*.auth_token");
|
settingsFilter.add("xpack.notification.pagerduty." + PagerDutyAccount.SERVICE_KEY_SETTING);
|
||||||
|
settingsFilter.add("xpack.notification.pagerduty.account.*." + PagerDutyAccount.SERVICE_KEY_SETTING);
|
||||||
|
settingsFilter.add("xpack.notification.hipchat.account.*.auth_token");
|
||||||
|
return settingsFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
|
public Collection<Class<? extends LifecycleComponent>> nodeServices() {
|
||||||
|
|
|
@ -19,12 +19,10 @@ import org.elasticsearch.common.network.NetworkModule;
|
||||||
import org.elasticsearch.common.regex.Regex;
|
import org.elasticsearch.common.regex.Regex;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
import org.elasticsearch.common.settings.Setting;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.settings.SettingsModule;
|
|
||||||
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
||||||
import org.elasticsearch.script.ScriptModule;
|
import org.elasticsearch.script.ScriptModule;
|
||||||
import org.elasticsearch.threadpool.ExecutorBuilder;
|
import org.elasticsearch.threadpool.ExecutorBuilder;
|
||||||
import org.elasticsearch.threadpool.FixedExecutorBuilder;
|
import org.elasticsearch.threadpool.FixedExecutorBuilder;
|
||||||
import org.elasticsearch.threadpool.ThreadPoolModule;
|
|
||||||
import org.elasticsearch.xpack.XPackPlugin;
|
import org.elasticsearch.xpack.XPackPlugin;
|
||||||
import org.elasticsearch.xpack.common.init.LazyInitializationModule;
|
import org.elasticsearch.xpack.common.init.LazyInitializationModule;
|
||||||
import org.elasticsearch.xpack.watcher.actions.WatcherActionModule;
|
import org.elasticsearch.xpack.watcher.actions.WatcherActionModule;
|
||||||
|
@ -140,33 +138,32 @@ public class Watcher {
|
||||||
return Settings.EMPTY;
|
return Settings.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onModule(ScriptModule module) {
|
|
||||||
module.registerScriptContext(ScriptServiceProxy.INSTANCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onModule(SettingsModule module) {
|
public List<Setting<?>> getSettings() {
|
||||||
|
List<Setting<?>> settings = new ArrayList<>();
|
||||||
for (TemplateConfig templateConfig : WatcherIndexTemplateRegistry.TEMPLATE_CONFIGS) {
|
for (TemplateConfig templateConfig : WatcherIndexTemplateRegistry.TEMPLATE_CONFIGS) {
|
||||||
module.registerSetting(templateConfig.getSetting());
|
settings.add(templateConfig.getSetting());
|
||||||
}
|
}
|
||||||
module.registerSetting(INDEX_WATCHER_VERSION_SETTING);
|
settings.add(INDEX_WATCHER_VERSION_SETTING);
|
||||||
module.registerSetting(INDEX_WATCHER_TEMPLATE_VERSION_SETTING);
|
settings.add(INDEX_WATCHER_TEMPLATE_VERSION_SETTING);
|
||||||
module.registerSetting(Setting.intSetting("xpack.watcher.execution.scroll.size", 0, Setting.Property.NodeScope));
|
settings.add(Setting.intSetting("xpack.watcher.execution.scroll.size", 0, Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.intSetting("xpack.watcher.watch.scroll.size", 0, Setting.Property.NodeScope));
|
settings.add(Setting.intSetting("xpack.watcher.watch.scroll.size", 0, Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.boolSetting(XPackPlugin.featureEnabledSetting(Watcher.NAME), true, Setting.Property.NodeScope));
|
settings.add(Setting.boolSetting(XPackPlugin.featureEnabledSetting(Watcher.NAME), true, Setting.Property.NodeScope));
|
||||||
module.registerSetting(ENCRYPT_SENSITIVE_DATA_SETTING);
|
settings.add(ENCRYPT_SENSITIVE_DATA_SETTING);
|
||||||
|
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.search.default_timeout", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.internal.ops.search.default_timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.bulk.default_timeout", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.internal.ops.bulk.default_timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.index.default_timeout", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.internal.ops.index.default_timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.execution.default_throttle_period", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.execution.default_throttle_period", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.actions.index.default_timeout", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.actions.index.default_timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.index.rest.direct_access", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.index.rest.direct_access", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.trigger.schedule.engine", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.trigger.schedule.engine", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.input.search.default_timeout", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.input.search.default_timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.transform.search.default_timeout", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.transform.search.default_timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.trigger.schedule.ticker.tick_interval", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.trigger.schedule.ticker.tick_interval", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.execution.scroll.timeout", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.execution.scroll.timeout", Setting.Property.NodeScope));
|
||||||
module.registerSetting(Setting.simpleString("xpack.watcher.start_immediately", Setting.Property.NodeScope));
|
settings.add(Setting.simpleString("xpack.watcher.start_immediately", Setting.Property.NodeScope));
|
||||||
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ExecutorBuilder<?>> getExecutorBuilders(final Settings settings) {
|
public List<ExecutorBuilder<?>> getExecutorBuilders(final Settings settings) {
|
||||||
|
@ -282,4 +279,5 @@ public class Watcher {
|
||||||
"[.watcher-history-YYYY.MM.dd] are allowed to be created", value);
|
"[.watcher-history-YYYY.MM.dd] are allowed to be created", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,9 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.script;
|
package org.elasticsearch.script;
|
||||||
|
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.xpack.common.text.DefaultTextTemplateEngine;
|
import org.elasticsearch.xpack.common.text.DefaultTextTemplateEngine;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,11 +20,10 @@ public class MockMustacheScriptEngine extends MockScriptEngine {
|
||||||
public static final String NAME = "mustache";
|
public static final String NAME = "mustache";
|
||||||
|
|
||||||
public static class TestPlugin extends MockScriptEngine.TestPlugin {
|
public static class TestPlugin extends MockScriptEngine.TestPlugin {
|
||||||
|
@Override
|
||||||
public void onModule(ScriptModule module) {
|
public ScriptEngineService getScriptEngineService(Settings settings) {
|
||||||
module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(MockMustacheScriptEngine.class, NAME, true));
|
return new MockMustacheScriptEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,4 +44,9 @@ public class MockMustacheScriptEngine extends MockScriptEngine {
|
||||||
|
|
||||||
return super.compile(name, script, params);
|
return super.compile(name, script, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInlineScriptEnabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
package org.elasticsearch.script;
|
package org.elasticsearch.script;
|
||||||
|
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
|
import org.elasticsearch.plugins.ScriptPlugin;
|
||||||
import org.elasticsearch.search.lookup.SearchLookup;
|
import org.elasticsearch.search.lookup.SearchLookup;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,13 +22,11 @@ public class SleepScriptEngine implements ScriptEngineService {
|
||||||
|
|
||||||
public static final String NAME = "sleep";
|
public static final String NAME = "sleep";
|
||||||
|
|
||||||
public static class TestPlugin extends Plugin {
|
public static class TestPlugin extends Plugin implements ScriptPlugin {
|
||||||
|
@Override
|
||||||
public void onModule(ScriptModule module) {
|
public ScriptEngineService getScriptEngineService(Settings settings) {
|
||||||
module.addScriptEngine(new ScriptEngineRegistry.ScriptEngineRegistration(SleepScriptEngine.class,
|
return new SleepScriptEngine();
|
||||||
SleepScriptEngine.NAME, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -79,4 +78,8 @@ public class SleepScriptEngine implements ScriptEngineService {
|
||||||
.params(Collections.singletonMap("millis", millis)).build();
|
.params(Collections.singletonMap("millis", millis)).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInlineScriptEnabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ import org.elasticsearch.xpack.watcher.test.AbstractWatcherIntegrationTestCase;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST;
|
import static org.elasticsearch.test.ESIntegTestCase.Scope.TEST;
|
||||||
|
@ -77,8 +79,9 @@ public class WatcherIndexTemplateRegistryTests extends AbstractWatcherIntegratio
|
||||||
|
|
||||||
public static final Setting<String> KEY_1 = new Setting<>("index.key1", "", Function.identity(), Setting.Property.IndexScope);
|
public static final Setting<String> KEY_1 = new Setting<>("index.key1", "", Function.identity(), Setting.Property.IndexScope);
|
||||||
|
|
||||||
public void onModule(SettingsModule module) {
|
@Override
|
||||||
module.registerSetting(KEY_1);
|
public List<Setting<?>> getSettings() {
|
||||||
|
return Collections.singletonList(KEY_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ public final class WatcherTestUtils {
|
||||||
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, scriptContextRegistry);
|
ScriptSettings scriptSettings = new ScriptSettings(scriptEngineRegistry, scriptContextRegistry);
|
||||||
ClusterService clusterService = Mockito.mock(ClusterService.class);
|
ClusterService clusterService = Mockito.mock(ClusterService.class);
|
||||||
Mockito.when(clusterService.state()).thenReturn(ClusterState.builder(new ClusterName("_name")).build());
|
Mockito.when(clusterService.state()).thenReturn(ClusterState.builder(new ClusterName("_name")).build());
|
||||||
return ScriptServiceProxy.of(new ScriptService(settings, new Environment(settings), Collections.emptySet(),
|
return ScriptServiceProxy.of(new ScriptService(settings, new Environment(settings),
|
||||||
new ResourceWatcherService(settings, tp), scriptEngineRegistry, scriptContextRegistry, scriptSettings),
|
new ResourceWatcherService(settings, tp), scriptEngineRegistry, scriptContextRegistry, scriptSettings),
|
||||||
clusterService);
|
clusterService);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue