Fix EC2 Discovery settings (#17651)

Fixes two bugs introduced by the settings refactoring in #16602
This commit is contained in:
Yannick Welsch 2016-04-11 16:17:55 +02:00
parent 9fc4ce294a
commit b08d453a0a
2 changed files with 7 additions and 9 deletions

View File

@ -76,8 +76,8 @@ public class AwsEc2ServiceImpl extends AbstractLifecycleComponent<AwsEc2Service>
String key = CLOUD_EC2.KEY_SETTING.get(settings);
String secret = CLOUD_EC2.SECRET_SETTING.get(settings);
if (CLOUD_EC2.PROXY_HOST_SETTING.exists(settings)) {
String proxyHost = CLOUD_EC2.PROXY_HOST_SETTING.get(settings);
if (proxyHost != null) {
Integer proxyPort = CLOUD_EC2.PROXY_PORT_SETTING.get(settings);
String proxyUsername = CLOUD_EC2.PROXY_USERNAME_SETTING.get(settings);
String proxyPassword = CLOUD_EC2.PROXY_PASSWORD_SETTING.get(settings);
@ -130,12 +130,13 @@ public class AwsEc2ServiceImpl extends AbstractLifecycleComponent<AwsEc2Service>
this.client = new AmazonEC2Client(credentials, clientConfiguration);
String endpoint = CLOUD_EC2.ENDPOINT_SETTING.get(settings);
if (endpoint != null) {
if (CLOUD_EC2.ENDPOINT_SETTING.exists(settings)) {
final String endpoint = CLOUD_EC2.ENDPOINT_SETTING.get(settings);
logger.debug("using explicit ec2 endpoint [{}]", endpoint);
client.setEndpoint(endpoint);
} else if (CLOUD_EC2.REGION_SETTING.exists(settings)) {
String region = CLOUD_EC2.REGION_SETTING.get(settings);
final String region = CLOUD_EC2.REGION_SETTING.get(settings);
final String endpoint;
if (region.equals("us-east-1") || region.equals("us-east")) {
endpoint = "ec2.us-east-1.amazonaws.com";
} else if (region.equals("us-west") || region.equals("us-west-1")) {

View File

@ -44,10 +44,7 @@ public abstract class AbstractAwsTestCase extends ESIntegTestCase {
protected Settings nodeSettings(int nodeOrdinal) {
Settings.Builder settings = Settings.builder()
.put(super.nodeSettings(nodeOrdinal))
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
.put("cloud.aws.test.random", randomInt())
.put("cloud.aws.test.write_failures", 0.1)
.put("cloud.aws.test.read_failures", 0.1);
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir());
// if explicit, just load it and don't load from env
try {