Indexing: Allow null userData.

This commit is contained in:
Gian Merlino 2014-06-18 10:08:50 -07:00
parent e9ef1e956c
commit 5c4b9a7d5b
1 changed files with 9 additions and 6 deletions

View File

@ -35,7 +35,6 @@ import com.google.common.collect.Lists;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.metamx.emitter.EmittingLogger; import com.metamx.emitter.EmittingLogger;
import io.druid.indexing.overlord.setup.EC2NodeData; import io.druid.indexing.overlord.setup.EC2NodeData;
import io.druid.indexing.overlord.setup.EC2UserData;
import io.druid.indexing.overlord.setup.WorkerSetupData; import io.druid.indexing.overlord.setup.WorkerSetupData;
import java.util.List; import java.util.List;
@ -68,12 +67,16 @@ public class EC2AutoScalingStrategy implements AutoScalingStrategy
try { try {
final WorkerSetupData setupData = workerSetupDataRef.get(); final WorkerSetupData setupData = workerSetupDataRef.get();
final EC2NodeData workerConfig = setupData.getNodeData(); final EC2NodeData workerConfig = setupData.getNodeData();
final EC2UserData userData; final String userDataBase64;
if (config.getWorkerVersion() == null) { if (setupData.getUserData() == null) {
userData = setupData.getUserData(); userDataBase64 = null;
} else { } else {
userData = setupData.getUserData().withVersion(config.getWorkerVersion()); if (config.getWorkerVersion() == null) {
userDataBase64 = setupData.getUserData().getUserDataBase64();
} else {
userDataBase64 = setupData.getUserData().withVersion(config.getWorkerVersion()).getUserDataBase64();
}
} }
final RunInstancesResult result = amazonEC2Client.runInstances( final RunInstancesResult result = amazonEC2Client.runInstances(
@ -86,7 +89,7 @@ public class EC2AutoScalingStrategy implements AutoScalingStrategy
.withSecurityGroupIds(workerConfig.getSecurityGroupIds()) .withSecurityGroupIds(workerConfig.getSecurityGroupIds())
.withPlacement(new Placement(setupData.getAvailabilityZone())) .withPlacement(new Placement(setupData.getAvailabilityZone()))
.withKeyName(workerConfig.getKeyName()) .withKeyName(workerConfig.getKeyName())
.withUserData(userData.getUserDataBase64()) .withUserData(userDataBase64)
); );
final List<String> instanceIds = Lists.transform( final List<String> instanceIds = Lists.transform(