convert more filters

This commit is contained in:
Simon Willnauer 2016-02-03 20:31:16 +01:00
parent f770164d9a
commit baacabf9fa
3 changed files with 13 additions and 11 deletions

View File

@ -59,8 +59,6 @@ public class AzureDiscoveryModule extends AbstractModule {
@Override @Override
protected void configure() { protected void configure() {
logger.debug("starting azure services"); logger.debug("starting azure services");
bind(AzureComputeSettingsFilter.class).asEagerSingleton();
// If we have set discovery to azure, let's start the azure compute service // If we have set discovery to azure, let's start the azure compute service
if (isDiscoveryReady(settings, logger)) { if (isDiscoveryReady(settings, logger)) {
logger.debug("starting azure discovery service"); logger.debug("starting azure discovery service");

View File

@ -43,7 +43,6 @@ import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.network.NetworkService;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsFilter;
import java.util.Locale; import java.util.Locale;
import java.util.Random; import java.util.Random;
@ -58,15 +57,8 @@ public class AwsEc2ServiceImpl extends AbstractLifecycleComponent<AwsEc2Service>
private AmazonEC2Client client; private AmazonEC2Client client;
@Inject @Inject
public AwsEc2ServiceImpl(Settings settings, SettingsFilter settingsFilter, NetworkService networkService, DiscoveryNodeService discoveryNodeService) { public AwsEc2ServiceImpl(Settings settings, NetworkService networkService, DiscoveryNodeService discoveryNodeService) {
super(settings); super(settings);
// Filter global settings
settingsFilter.addFilter(CLOUD_AWS.KEY);
settingsFilter.addFilter(CLOUD_AWS.SECRET);
settingsFilter.addFilter(CLOUD_AWS.PROXY_PASSWORD);
settingsFilter.addFilter(CLOUD_EC2.KEY);
settingsFilter.addFilter(CLOUD_EC2.SECRET);
settingsFilter.addFilter(CLOUD_EC2.PROXY_PASSWORD);
// add specific ec2 name resolver // add specific ec2 name resolver
networkService.addCustomNameResolver(new Ec2NameResolver(settings)); networkService.addCustomNameResolver(new Ec2NameResolver(settings));
discoveryNodeService.addCustomAttributeProvider(new Ec2CustomNodeAttributes(settings)); discoveryNodeService.addCustomAttributeProvider(new Ec2CustomNodeAttributes(settings));

View File

@ -25,6 +25,7 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import org.elasticsearch.SpecialPermission; import org.elasticsearch.SpecialPermission;
import org.elasticsearch.cloud.aws.AwsEc2Service;
import org.elasticsearch.cloud.aws.AwsEc2ServiceImpl; import org.elasticsearch.cloud.aws.AwsEc2ServiceImpl;
import org.elasticsearch.cloud.aws.Ec2Module; import org.elasticsearch.cloud.aws.Ec2Module;
import org.elasticsearch.common.component.LifecycleComponent; import org.elasticsearch.common.component.LifecycleComponent;
@ -32,6 +33,7 @@ import org.elasticsearch.common.inject.Module;
import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsModule;
import org.elasticsearch.discovery.DiscoveryModule; import org.elasticsearch.discovery.DiscoveryModule;
import org.elasticsearch.discovery.ec2.AwsEc2UnicastHostsProvider; import org.elasticsearch.discovery.ec2.AwsEc2UnicastHostsProvider;
import org.elasticsearch.discovery.ec2.Ec2Discovery; import org.elasticsearch.discovery.ec2.Ec2Discovery;
@ -100,4 +102,14 @@ public class Ec2DiscoveryPlugin extends Plugin {
discoveryModule.addUnicastHostProvider(AwsEc2UnicastHostsProvider.class); discoveryModule.addUnicastHostProvider(AwsEc2UnicastHostsProvider.class);
} }
} }
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);
}
} }