Issue-1051 overrideLoginUser not working

This commit is contained in:
vijaykiran 2012-08-03 01:14:09 +02:00
parent c6a02a6a57
commit 7a81769e1c
8 changed files with 63 additions and 31 deletions

View File

@ -20,7 +20,6 @@ package org.jclouds.ec2.compute.config;
import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_TIMEOUT_SECURITYGROUP_PRESENT; import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_TIMEOUT_SECURITYGROUP_PRESENT;
import java.security.SecureRandom;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -35,7 +34,6 @@ import org.jclouds.compute.domain.NodeMetadata.Status;
import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.extensions.ImageExtension; import org.jclouds.compute.extensions.ImageExtension;
import org.jclouds.compute.options.TemplateOptions; import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.jclouds.ec2.compute.EC2ComputeService; import org.jclouds.ec2.compute.EC2ComputeService;
import org.jclouds.ec2.compute.domain.PasswordDataAndPrivateKey; import org.jclouds.ec2.compute.domain.PasswordDataAndPrivateKey;
@ -67,7 +65,6 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Functions; import com.google.common.base.Functions;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader; import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
@ -120,7 +117,7 @@ public class EC2ComputeServiceDependenciesModule extends AbstractModule {
bind(TemplateBuilder.class).to(EC2TemplateBuilderImpl.class); bind(TemplateBuilder.class).to(EC2TemplateBuilderImpl.class);
bind(TemplateOptions.class).to(EC2TemplateOptions.class); bind(TemplateOptions.class).to(EC2TemplateOptions.class);
bind(ComputeService.class).to(EC2ComputeService.class); bind(ComputeService.class).to(EC2ComputeService.class);
bind(new TypeLiteral<CacheLoader<RunningInstance, Credentials>>() { bind(new TypeLiteral<CacheLoader<RunningInstance, LoginCredentials>>() {
}).to(CredentialsForInstance.class); }).to(CredentialsForInstance.class);
bind(new TypeLiteral<Function<RegionAndName, KeyPair>>() { bind(new TypeLiteral<Function<RegionAndName, KeyPair>>() {
}).to(CreateUniqueKeyPair.class); }).to(CreateUniqueKeyPair.class);
@ -157,7 +154,7 @@ public class EC2ComputeServiceDependenciesModule extends AbstractModule {
@Provides @Provides
@Singleton @Singleton
protected LoadingCache<RunningInstance, Credentials> credentialsMap(CacheLoader<RunningInstance, Credentials> in) { protected LoadingCache<RunningInstance, LoginCredentials> credentialsMap(CacheLoader<RunningInstance, LoginCredentials> in) {
return CacheBuilder.newBuilder().build(in); return CacheBuilder.newBuilder().build(in);
} }

View File

@ -27,7 +27,6 @@ import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.jclouds.ec2.compute.domain.RegionAndName; import org.jclouds.ec2.compute.domain.RegionAndName;
import org.jclouds.ec2.domain.KeyPair; import org.jclouds.ec2.domain.KeyPair;
@ -44,7 +43,7 @@ import com.google.common.cache.LoadingCache;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Singleton @Singleton
public class CredentialsForInstance extends CacheLoader<RunningInstance, Credentials> { public class CredentialsForInstance extends CacheLoader<RunningInstance, LoginCredentials> {
private final ConcurrentMap<RegionAndName, KeyPair> credentialsMap; private final ConcurrentMap<RegionAndName, KeyPair> credentialsMap;
private final Supplier<LoadingCache<RegionAndName, ? extends Image>> imageMap; private final Supplier<LoadingCache<RegionAndName, ? extends Image>> imageMap;
@ -59,11 +58,11 @@ public class CredentialsForInstance extends CacheLoader<RunningInstance, Credent
} }
@Override @Override
public Credentials load(final RunningInstance instance) throws ExecutionException { public LoginCredentials load(final RunningInstance instance) throws ExecutionException {
if ("windows".equals(instance.getPlatform())) { if ("windows".equals(instance.getPlatform())) {
return passwordCredentialsFromWindowsInstance.apply(instance); return passwordCredentialsFromWindowsInstance.apply(instance);
} else if (instance.getKeyName() != null) { } else if (instance.getKeyName() != null) {
return new Credentials(getLoginAccountFor(instance), getPrivateKeyOrNull(instance)); return LoginCredentials.builder().user(getLoginAccountFor(instance)).privateKey(getPrivateKeyOrNull(instance)).build();
} }
return null; return null;
} }

View File

@ -39,10 +39,13 @@ import org.jclouds.compute.config.CustomizationResponse;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.domain.TemplateBuilder;
import static org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials.*;
import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet; import org.jclouds.compute.strategy.CreateNodesInGroupThenAddToSet;
import org.jclouds.compute.util.ComputeUtils; import org.jclouds.compute.util.ComputeUtils;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
import org.jclouds.ec2.compute.domain.RegionAndName; import org.jclouds.ec2.compute.domain.RegionAndName;
import org.jclouds.ec2.compute.predicates.InstancePresent; import org.jclouds.ec2.compute.predicates.InstancePresent;
@ -57,9 +60,9 @@ import com.google.common.base.Joiner;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.common.collect.ImmutableSet.Builder;
/** /**
* creates futures that correlate to * creates futures that correlate to
@ -91,12 +94,10 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
@VisibleForTesting @VisibleForTesting
final ComputeUtils utils; final ComputeUtils utils;
final InstancePresent instancePresent; final InstancePresent instancePresent;
final LoadingCache<RunningInstance, Credentials> instanceToCredentials; final LoadingCache<RunningInstance, LoginCredentials> instanceToCredentials;
final Map<String, Credentials> credentialStore; final Map<String, Credentials> credentialStore;
final Provider<TemplateBuilder> templateBuilderProvider; final Provider<TemplateBuilder> templateBuilderProvider;
@Inject @Inject
protected EC2CreateNodesInGroupThenAddToSet( protected EC2CreateNodesInGroupThenAddToSet(
EC2Client client, EC2Client client,
@ -106,7 +107,7 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
Provider<TemplateBuilder> templateBuilderProvider, Provider<TemplateBuilder> templateBuilderProvider,
CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize, CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize,
InstancePresent instancePresent, Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata, InstancePresent instancePresent, Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata,
LoadingCache<RunningInstance, Credentials> instanceToCredentials, Map<String, Credentials> credentialStore, LoadingCache<RunningInstance, LoginCredentials> instanceToCredentials, Map<String, Credentials> credentialStore,
ComputeUtils utils) { ComputeUtils utils) {
this.client = checkNotNull(client, "client"); this.client = checkNotNull(client, "client");
this.elasticIpCache = checkNotNull(elasticIpCache, "elasticIpCache"); this.elasticIpCache = checkNotNull(elasticIpCache, "elasticIpCache");
@ -147,7 +148,7 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
logger.debug("<< started instances(%s)", idsString); logger.debug("<< started instances(%s)", idsString);
all(ids, instancePresent); all(ids, instancePresent);
logger.debug("<< present instances(%s)", idsString); logger.debug("<< present instances(%s)", idsString);
populateCredentials(started); populateCredentials(started, template.getOptions());
} }
assignElasticIpsToInstances(ips, started); assignElasticIpsToInstances(ips, started);
@ -156,13 +157,14 @@ public class EC2CreateNodesInGroupThenAddToSet implements CreateNodesInGroupThen
runningInstanceToNodeMetadata), goodNodes, badNodes, customizationResponses); runningInstanceToNodeMetadata), goodNodes, badNodes, customizationResponses);
} }
protected void populateCredentials(Iterable<? extends RunningInstance> started) { protected void populateCredentials(Iterable<? extends RunningInstance> started, TemplateOptions options) {
Credentials credentials = null; LoginCredentials credentials = null;
for (RunningInstance instance : started) { for (RunningInstance instance : started) {
credentials = instanceToCredentials.apply(instance); credentials = instanceToCredentials.apply(instance);
if (credentials != null) if (credentials != null)
break; break;
} }
credentials = overrideDefaultCredentialsWithOptionsIfPresent(credentials, options);
if (credentials != null) if (credentials != null)
for (RunningInstance instance : started) for (RunningInstance instance : started)
credentialStore.put("node#" + instance.getRegion() + "/" + instance.getId(), credentials); credentialStore.put("node#" + instance.getRegion() + "/" + instance.getId(), credentials);

View File

@ -207,8 +207,6 @@ public class EC2ComputeServiceExpectTest extends BaseEC2ComputeServiceExpectTest
.addFormParam("Action", "DescribeImages").build()); .addFormParam("Action", "DescribeImages").build());
} }
//TODO: FIXME!!
@Test(enabled = false)
public void testCreateNodeWithGeneratedKeyPairAndOverriddenLoginUser() throws Exception { public void testCreateNodeWithGeneratedKeyPairAndOverriddenLoginUser() throws Exception {
Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
requestResponseMap.put(describeRegionsRequest, describeRegionsResponse); requestResponseMap.put(describeRegionsRequest, describeRegionsResponse);
@ -228,8 +226,34 @@ public class EC2ComputeServiceExpectTest extends BaseEC2ComputeServiceExpectTest
NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1, NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
blockUntilRunning(false).overrideLoginUser("ec2-user"))); blockUntilRunning(false).overrideLoginUser("ec2-user")));
assertEquals(node.getCredentials().getUser(), "ec2-user"); assertEquals(node.getCredentials().getUser(), "ec2-user");
System.out.println(node.getImageId());
assertNotNull(node.getCredentials().getPrivateKey()); assertNotNull(node.getCredentials().getPrivateKey());
} }
//FIXME - issue-1051
@Test(enabled = false)
public void testCreateNodeWithGeneratedKeyPairAndOverriddenLoginUserWithTemplateBuilder() throws Exception {
Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder();
requestResponseMap.put(describeRegionsRequest, describeRegionsResponse);
requestResponseMap.put(describeAvailabilityZonesRequest, describeAvailabilityZonesResponse);
requestResponseMap.put(describeImagesRequest, describeImagesResponse);
requestResponseMap.put(createKeyPairRequest, createKeyPairResponse);
requestResponseMap.put(createSecurityGroupRequest, createSecurityGroupResponse);
requestResponseMap.put(describeSecurityGroupRequest, describeSecurityGroupResponse);
requestResponseMap.put(authorizeSecurityGroupIngressRequest22, authorizeSecurityGroupIngressResponse);
requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, authorizeSecurityGroupIngressResponse);
requestResponseMap.put(runInstancesRequest, runInstancesResponse);
requestResponseMap.put(describeInstanceRequest, describeInstanceResponse);
requestResponseMap.put(describeImageRequest, describeImagesResponse);
ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build());
NodeMetadata node = Iterables.getOnlyElement(
apiThatCreatesNode.createNodesInGroup("test", 1,
apiThatCreatesNode.templateBuilder().from("osDescriptionMatches=.*fedora.*,loginUser=ec2-user").build()));
assertEquals(node.getCredentials().getUser(), "ec2-user");
assertNotNull(node.getCredentials().getPrivateKey());
}
} }

View File

@ -33,10 +33,10 @@ import org.jclouds.compute.config.CustomizationResponse;
import org.jclouds.compute.domain.Hardware; import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadata.Status;
import org.jclouds.compute.domain.NodeMetadataBuilder; import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder; import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.domain.NodeMetadata.Status;
import org.jclouds.compute.predicates.AtomicNodeRunning; import org.jclouds.compute.predicates.AtomicNodeRunning;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy; import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.util.ComputeUtils; import org.jclouds.compute.util.ComputeUtils;
@ -44,6 +44,7 @@ import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.domain.LocationBuilder; import org.jclouds.domain.LocationBuilder;
import org.jclouds.domain.LocationScope; import org.jclouds.domain.LocationScope;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
import org.jclouds.ec2.compute.domain.RegionAndName; import org.jclouds.ec2.compute.domain.RegionAndName;
import org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata; import org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata;
@ -116,13 +117,17 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
Reservation.class.cast(reservation)); Reservation.class.cast(reservation));
expect(instance.getId()).andReturn(instanceCreatedId).atLeastOnce(); expect(instance.getId()).andReturn(instanceCreatedId).atLeastOnce();
// simulate a lazy credentials fetch // simulate a lazy credentials fetch
Credentials creds = new Credentials("foo", "bar"); LoginCredentials creds = LoginCredentials.builder().user("foo").privateKey("bar").build();
expect(strategy.instanceToCredentials.apply(instance)).andReturn(creds); expect(strategy.instanceToCredentials.apply(instance)).andReturn(creds);
expect(instance.getRegion()).andReturn(region).atLeastOnce(); expect(instance.getRegion()).andReturn(region).atLeastOnce();
expect(strategy.credentialStore.put("node#" + region + "/" + instanceCreatedId, creds)).andReturn(null); expect(strategy.credentialStore.put("node#" + region + "/" + instanceCreatedId, creds)).andReturn(null);
expect(strategy.instancePresent.apply(new RegionAndName(region, instanceCreatedId))).andReturn(true); expect(strategy.instancePresent.apply(new RegionAndName(region, instanceCreatedId))).andReturn(true);
expect(input.template.getOptions()).andReturn(input.options).atLeastOnce(); expect(input.template.getOptions()).andReturn(input.options).atLeastOnce();
expect(input.options.getLoginUser()).andReturn(null);
expect(input.options.getLoginPassword()).andReturn(null);
expect(input.options.getLoginPrivateKey()).andReturn(null);
expect(input.options.shouldAuthenticateSudo()).andReturn(null);
expect( expect(
strategy.utils.customizeNodesAndAddToGoodMapOrPutExceptionIntoBadMap(eq(input.options), strategy.utils.customizeNodesAndAddToGoodMapOrPutExceptionIntoBadMap(eq(input.options),
@ -213,13 +218,18 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
Reservation.class.cast(reservation)); Reservation.class.cast(reservation));
expect(instance.getId()).andReturn(instanceCreatedId).atLeastOnce(); expect(instance.getId()).andReturn(instanceCreatedId).atLeastOnce();
// simulate a lazy credentials fetch // simulate a lazy credentials fetch
Credentials creds = new Credentials("foo", "bar"); LoginCredentials creds = LoginCredentials.builder().user("foo").privateKey("bar").build();
expect(strategy.instanceToCredentials.apply(instance)).andReturn(creds); expect(strategy.instanceToCredentials.apply(instance)).andReturn(creds);
expect(instance.getRegion()).andReturn(region).atLeastOnce(); expect(instance.getRegion()).andReturn(region).atLeastOnce();
expect(strategy.credentialStore.put("node#" + region + "/" + instanceCreatedId, creds)).andReturn(null); expect(strategy.credentialStore.put("node#" + region + "/" + instanceCreatedId, creds)).andReturn(null);
expect(strategy.instancePresent.apply(new RegionAndName(region, instanceCreatedId))).andReturn(true); expect(strategy.instancePresent.apply(new RegionAndName(region, instanceCreatedId))).andReturn(true);
expect(input.template.getOptions()).andReturn(input.options).atLeastOnce(); expect(input.template.getOptions()).andReturn(input.options).atLeastOnce();
expect(input.options.getLoginUser()).andReturn(null);
expect(input.options.getLoginPassword()).andReturn(null);
expect(input.options.getLoginPrivateKey()).andReturn(null);
expect(input.options.shouldAuthenticateSudo()).andReturn(null);
expect(strategy.runningInstanceToNodeMetadata.apply(instance)).andReturn(nodeMetadata); expect(strategy.runningInstanceToNodeMetadata.apply(instance)).andReturn(nodeMetadata);
expect( expect(
@ -310,7 +320,7 @@ public class EC2CreateNodesInGroupThenAddToSetTest {
CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize = createMock(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class); CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize = createMock(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class);
InstancePresent instancePresent = createMock(InstancePresent.class); InstancePresent instancePresent = createMock(InstancePresent.class);
RunningInstanceToNodeMetadata runningInstanceToNodeMetadata = createMock(RunningInstanceToNodeMetadata.class); RunningInstanceToNodeMetadata runningInstanceToNodeMetadata = createMock(RunningInstanceToNodeMetadata.class);
LoadingCache<RunningInstance, Credentials> instanceToCredentials = createMock(LoadingCache.class); LoadingCache<RunningInstance, LoginCredentials> instanceToCredentials = createMock(LoadingCache.class);
LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class); LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
GetNodeMetadataStrategy nodeRunning = new GetNodeMetadataStrategy(){ GetNodeMetadataStrategy nodeRunning = new GetNodeMetadataStrategy(){

View File

@ -20,7 +20,7 @@
<privateDnsName/> <privateDnsName/>
<dnsName/> <dnsName/>
<reason/> <reason/>
<keyName>jclouds#test#1</keyName> <keyName>jclouds#test#0</keyName>
<amiLaunchIndex>0</amiLaunchIndex> <amiLaunchIndex>0</amiLaunchIndex>
<productCodes/> <productCodes/>
<instanceType>t1.micro</instanceType> <instanceType>t1.micro</instanceType>
@ -53,4 +53,4 @@
<hypervisor>xen</hypervisor> <hypervisor>xen</hypervisor>
</item> </item>
</instancesSet> </instancesSet>
</RunInstancesResponse> </RunInstancesResponse>

View File

@ -45,7 +45,6 @@ import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.extensions.ImageExtension; import org.jclouds.compute.extensions.ImageExtension;
import org.jclouds.compute.options.TemplateOptions; import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.config.ValueOfConfigurationKeyOrNull; import org.jclouds.config.ValueOfConfigurationKeyOrNull;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
import org.jclouds.ec2.compute.config.EC2ComputeServiceDependenciesModule; import org.jclouds.ec2.compute.config.EC2ComputeServiceDependenciesModule;
import org.jclouds.ec2.compute.domain.PasswordDataAndPrivateKey; import org.jclouds.ec2.compute.domain.PasswordDataAndPrivateKey;
@ -90,7 +89,7 @@ public class AWSEC2ComputeServiceDependenciesModule extends EC2ComputeServiceDep
bind(TemplateBuilder.class).to(EC2TemplateBuilderImpl.class); bind(TemplateBuilder.class).to(EC2TemplateBuilderImpl.class);
bind(TemplateOptions.class).to(AWSEC2TemplateOptions.class); bind(TemplateOptions.class).to(AWSEC2TemplateOptions.class);
bind(ComputeService.class).to(AWSEC2ComputeService.class); bind(ComputeService.class).to(AWSEC2ComputeService.class);
bind(new TypeLiteral<CacheLoader<RunningInstance, Credentials>>() { bind(new TypeLiteral<CacheLoader<RunningInstance, LoginCredentials>>() {
}).to(CredentialsForInstance.class); }).to(CredentialsForInstance.class);
bind(new TypeLiteral<CacheLoader<RegionAndName, String>>() { bind(new TypeLiteral<CacheLoader<RegionAndName, String>>() {
}).annotatedWith(Names.named("SECURITY")).to(CreateSecurityGroupIfNeeded.class); }).annotatedWith(Names.named("SECURITY")).to(CreateSecurityGroupIfNeeded.class);

View File

@ -47,6 +47,7 @@ import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.compute.util.ComputeUtils; import org.jclouds.compute.util.ComputeUtils;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.ec2.compute.domain.RegionAndName; import org.jclouds.ec2.compute.domain.RegionAndName;
import org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet; import org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet;
import org.jclouds.ec2.domain.RunningInstance; import org.jclouds.ec2.domain.RunningInstance;
@ -88,7 +89,7 @@ public class AWSEC2CreateNodesInGroupThenAddToSet extends EC2CreateNodesInGroupT
CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize, CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize,
AWSEC2InstancePresent instancePresent, AWSEC2InstancePresent instancePresent,
Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata, Function<RunningInstance, NodeMetadata> runningInstanceToNodeMetadata,
LoadingCache<RunningInstance, Credentials> instanceToCredentials, Map<String, Credentials> credentialStore, LoadingCache<RunningInstance, LoginCredentials> instanceToCredentials, Map<String, Credentials> credentialStore,
ComputeUtils utils, SpotInstanceRequestToAWSRunningInstance spotConverter) { ComputeUtils utils, SpotInstanceRequestToAWSRunningInstance spotConverter) {
super(client, elasticIpCache, nodeRunning, templateBuilderProvider, createKeyPairAndSecurityGroupsAsNeededAndReturncustomize, super(client, elasticIpCache, nodeRunning, templateBuilderProvider, createKeyPairAndSecurityGroupsAsNeededAndReturncustomize,
instancePresent, runningInstanceToNodeMetadata, instanceToCredentials, credentialStore, utils); instancePresent, runningInstanceToNodeMetadata, instanceToCredentials, credentialStore, utils);
@ -146,4 +147,4 @@ public class AWSEC2CreateNodesInGroupThenAddToSet extends EC2CreateNodesInGroupT
return options instanceof AWSEC2TemplateOptions ? AWSEC2TemplateOptions.class.cast(options).getSpotPrice() : null; return options instanceof AWSEC2TemplateOptions ? AWSEC2TemplateOptions.class.cast(options).getSpotPrice() : null;
} }
} }