diff --git a/core/src/main/java/org/elasticsearch/common/settings/SettingsModule.java b/core/src/main/java/org/elasticsearch/common/settings/SettingsModule.java index 4e8940f4371..31c13a8dfd0 100644 --- a/core/src/main/java/org/elasticsearch/common/settings/SettingsModule.java +++ b/core/src/main/java/org/elasticsearch/common/settings/SettingsModule.java @@ -96,6 +96,12 @@ public class SettingsModule extends AbstractModule { settingsFilterPattern.add(filter); } + public void registerSettingsFilterIfMissing(String filter) { + if (settingsFilterPattern.contains(filter)) { + registerSettingsFilter(filter); + } + } + public void validateTribeSettings(Settings settings, ClusterSettings clusterSettings) { Map groups = settings.filter(TRIBE_CLIENT_NODE_SETTINGS_PREDICATE).getGroups("tribe.", true); diff --git a/plugins/discovery-ec2/src/main/java/org/elasticsearch/plugin/discovery/ec2/Ec2DiscoveryPlugin.java b/plugins/discovery-ec2/src/main/java/org/elasticsearch/plugin/discovery/ec2/Ec2DiscoveryPlugin.java index 42f4fbbf336..2e689d9d26c 100644 --- a/plugins/discovery-ec2/src/main/java/org/elasticsearch/plugin/discovery/ec2/Ec2DiscoveryPlugin.java +++ b/plugins/discovery-ec2/src/main/java/org/elasticsearch/plugin/discovery/ec2/Ec2DiscoveryPlugin.java @@ -105,11 +105,11 @@ public class Ec2DiscoveryPlugin extends Plugin { public void onModule(SettingsModule settingsModule) { // Filter global settings - settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_AWS.KEY); - settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_AWS.SECRET); - settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_AWS.PROXY_PASSWORD); - settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_EC2.KEY); - settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_EC2.SECRET); - settingsModule.registerSettingsFilter(AwsEc2Service.CLOUD_EC2.PROXY_PASSWORD); + settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_AWS.KEY); + settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_AWS.SECRET); + settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_AWS.PROXY_PASSWORD); + settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_EC2.KEY); + settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_EC2.SECRET); + settingsModule.registerSettingsFilterIfMissing(AwsEc2Service.CLOUD_EC2.PROXY_PASSWORD); } } diff --git a/plugins/repository-s3/src/main/java/org/elasticsearch/plugin/repository/s3/S3RepositoryPlugin.java b/plugins/repository-s3/src/main/java/org/elasticsearch/plugin/repository/s3/S3RepositoryPlugin.java index 829d0bae37f..9e3934a1c88 100644 --- a/plugins/repository-s3/src/main/java/org/elasticsearch/plugin/repository/s3/S3RepositoryPlugin.java +++ b/plugins/repository-s3/src/main/java/org/elasticsearch/plugin/repository/s3/S3RepositoryPlugin.java @@ -89,12 +89,12 @@ public class S3RepositoryPlugin extends Plugin { } public void onModule(SettingsModule module) { - module.registerSettingsFilter(AwsS3Service.CLOUD_AWS.KEY); - module.registerSettingsFilter(AwsS3Service.CLOUD_AWS.SECRET); - module.registerSettingsFilter(AwsS3Service.CLOUD_AWS.PROXY_PASSWORD); - module.registerSettingsFilter(AwsS3Service.CLOUD_S3.KEY); - module.registerSettingsFilter(AwsS3Service.CLOUD_S3.SECRET); - module.registerSettingsFilter(AwsS3Service.CLOUD_S3.PROXY_PASSWORD); + module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_AWS.KEY); + module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_AWS.SECRET); + module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_AWS.PROXY_PASSWORD); + module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_S3.KEY); + module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_S3.SECRET); + module.registerSettingsFilterIfMissing(AwsS3Service.CLOUD_S3.PROXY_PASSWORD); module.registerSettingsFilter("access_key"); // WTF is this? module.registerSettingsFilter("secret_key"); // WTF is this? }