Cut over settings registration to a pull model elastic/elasticsearchelastic/elasticsearch#18890 (elastic/elasticsearch#2538)

Followup for elastic/elasticsearchelastic/elasticsearch#18890

Original commit: elastic/x-pack-elasticsearch@a65ee6913f
This commit is contained in:
Simon Willnauer 2016-06-16 15:53:01 +02:00 committed by GitHub
parent 36ad326483
commit b2c944a480
27 changed files with 254 additions and 212 deletions

View File

@ -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 {
@ -69,10 +70,12 @@ public class Graph extends Plugin {
if (enabled && transportClientMode == false) { if (enabled && transportClientMode == false) {
module.registerRestHandler(RestGraphAction.class); module.registerRestHandler(RestGraphAction.class);
} }
} }
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));
}
} }

View File

@ -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));
} }
} }

View File

@ -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 {
@ -44,13 +46,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();

View File

@ -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) {

View File

@ -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.*");
} }

View File

@ -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) {

View File

@ -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);
} }
} }

View File

@ -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 {

View File

@ -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);
} }
} }

View File

@ -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

View File

@ -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);
} }
} }

View File

@ -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);
} }
} }

View File

@ -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);
} }
} }

View File

@ -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);
} }
} }

View File

@ -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);
} }
} }

View File

@ -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);
} }
} }

View File

@ -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;

View File

@ -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);
} }
} }

View File

@ -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) {

View File

@ -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);
} }
} }

View File

@ -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);
} }
} }

View File

@ -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");

View File

@ -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);

View File

@ -21,6 +21,7 @@ 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.plugins.ScriptPlugin;
import org.elasticsearch.script.ScriptContext; import org.elasticsearch.script.ScriptContext;
@ -28,7 +29,6 @@ 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;
@ -190,22 +190,34 @@ public class XPackPlugin extends Plugin implements ScriptPlugin {
return ScriptServiceProxy.INSTANCE; 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
@ -309,9 +321,9 @@ public class XPackPlugin extends Plugin implements ScriptPlugin {
* *
* {@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));
} }

View File

@ -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() {

View File

@ -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;
@ -141,29 +139,31 @@ public class Watcher {
} }
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) {
@ -279,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);
} }
} }

View File

@ -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;
@ -85,8 +87,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);
} }
} }
} }