mirror of https://github.com/apache/jclouds.git
Issue 718:update to latest amazon linux
This commit is contained in:
parent
326328b71b
commit
2642882f03
|
@ -45,9 +45,8 @@ public class AWSEC2PropertiesBuilder extends org.jclouds.ec2.EC2PropertiesBuilde
|
|||
// from stopping->stopped state on an ec2 micro
|
||||
properties.setProperty(PROPERTY_TIMEOUT_NODE_SUSPENDED, 120 * 1000 + "");
|
||||
// auth fail sometimes happens in EC2, as the rc.local script that injects the
|
||||
// authorized key executes after ssh has started. with amazon linux, ssh
|
||||
// starts after package updates, which means that this value can be higher.
|
||||
properties.setProperty("jclouds.ssh.max-retries", "10");
|
||||
// authorized key executes after ssh has started.
|
||||
properties.setProperty("jclouds.ssh.max-retries", "7");
|
||||
properties.setProperty("jclouds.ssh.retry-auth", "true");
|
||||
properties.setProperty(PROPERTY_ENDPOINT, "https://ec2.us-east-1.amazonaws.com");
|
||||
properties.putAll(Region.regionProperties());
|
||||
|
|
|
@ -38,11 +38,13 @@ import org.jclouds.aws.ec2.compute.suppliers.AWSRegionAndNameToImageSupplier;
|
|||
import org.jclouds.compute.config.BaseComputeServiceContextModule;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.compute.options.TemplateOptions;
|
||||
import org.jclouds.ec2.compute.config.EC2BindComputeStrategiesByClass;
|
||||
import org.jclouds.ec2.compute.config.EC2BindComputeSuppliersByClass;
|
||||
import org.jclouds.ec2.compute.domain.RegionAndName;
|
||||
import org.jclouds.ec2.compute.functions.RunningInstanceToNodeMetadata;
|
||||
import org.jclouds.ec2.compute.internal.EC2TemplateBuilderImpl;
|
||||
import org.jclouds.ec2.compute.options.EC2TemplateOptions;
|
||||
import org.jclouds.ec2.compute.predicates.InstancePresent;
|
||||
import org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions;
|
||||
import org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet;
|
||||
|
@ -71,7 +73,7 @@ public class AWSEC2ComputeServiceContextModule extends BaseComputeServiceContext
|
|||
install(new EC2BindComputeSuppliersByClass());
|
||||
bind(ReviseParsedImage.class).to(AWSEC2ReviseParsedImage.class);
|
||||
bind(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class).to(
|
||||
CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class);
|
||||
CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.class);
|
||||
bind(EC2HardwareSupplier.class).to(AWSEC2HardwareSupplier.class);
|
||||
bind(EC2TemplateBuilderImpl.class).to(AWSEC2TemplateBuilderImpl.class);
|
||||
bind(EC2GetNodeMetadataStrategy.class).to(AWSEC2GetNodeMetadataStrategy.class);
|
||||
|
@ -89,18 +91,30 @@ public class AWSEC2ComputeServiceContextModule extends BaseComputeServiceContext
|
|||
@Provides
|
||||
@Singleton
|
||||
protected Supplier<Cache<RegionAndName, ? extends Image>> provideRegionAndNameToImageSupplierCache(
|
||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final AWSRegionAndNameToImageSupplier supplier) {
|
||||
@Named(PROPERTY_SESSION_INTERVAL) long seconds, final AWSRegionAndNameToImageSupplier supplier) {
|
||||
return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<Cache<RegionAndName, ? extends Image>>(
|
||||
authException, seconds, new Supplier<Cache<RegionAndName, ? extends Image>>() {
|
||||
@Override
|
||||
public Cache<RegionAndName, ? extends Image> get() {
|
||||
return supplier.get();
|
||||
}
|
||||
});
|
||||
authException, seconds, new Supplier<Cache<RegionAndName, ? extends Image>>() {
|
||||
@Override
|
||||
public Cache<RegionAndName, ? extends Image> get() {
|
||||
return supplier.get();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
||||
return template.osFamily(AMZN_LINUX).os64Bit(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* With amazon linux 2011.09, ssh starts after package updates, which slows the boot process and
|
||||
* runs us out of ssh retries (context property {@code "jclouds.ssh.max-retries"}).
|
||||
*
|
||||
* @see <a href="http://aws.amazon.com/amazon-linux-ami/latest-release-notes/" />
|
||||
* @see AWSEC2PropertiesBuilder#defaultProperties
|
||||
*/
|
||||
@Override
|
||||
protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
|
||||
return options.as(EC2TemplateOptions.class).userData("#cloud-config\nrepo_upgrade: none\n".getBytes());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
|
|||
@Override
|
||||
@Test(dependsOnMethods = "testCompareSizes")
|
||||
public void testExtendedOptionsAndLogin() throws Exception {
|
||||
//note that this is sensitive to regions that quickly fill spot requests
|
||||
// note that this is sensitive to regions that quickly fill spot requests
|
||||
String region = "eu-west-1";
|
||||
|
||||
AWSSecurityGroupClient securityGroupClient = AWSEC2Client.class.cast(context.getProviderSpecificContext().getApi())
|
||||
|
@ -137,8 +137,9 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
|
|||
assert first.getCredentials().identity != null : first;
|
||||
|
||||
startedId = Iterables.getOnlyElement(nodes).getProviderId();
|
||||
|
||||
AWSRunningInstance instance = AWSRunningInstance.class.cast(getInstance(instanceClient, startedId));
|
||||
|
||||
AWSRunningInstance instance = AWSRunningInstance.class.cast(Iterables.getOnlyElement(Iterables.getOnlyElement(instanceClient
|
||||
.describeInstancesInRegion(region, startedId))));
|
||||
|
||||
assertEquals(instance.getKeyName(), group);
|
||||
assertEquals(instance.getMonitoringState(), MonitoringState.ENABLED);
|
||||
|
@ -160,8 +161,9 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
|
|||
+ instance.getRegion(), group));
|
||||
|
||||
// make sure our dummy group has no rules
|
||||
SecurityGroup secgroup = Iterables.getOnlyElement(securityGroupClient.describeSecurityGroupsInRegion(null,
|
||||
"jclouds#" + group + "#" + instance.getRegion()));
|
||||
SecurityGroup secgroup = Iterables.getOnlyElement(securityGroupClient.describeSecurityGroupsInRegion(instance
|
||||
.getRegion(), "jclouds#" + group + "#" + instance.getRegion()));
|
||||
|
||||
assert secgroup.getIpPermissions().size() == 0 : secgroup;
|
||||
|
||||
// try to run a script with the original keyPair
|
||||
|
|
|
@ -65,7 +65,7 @@ import com.google.inject.Module;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", sequential = true)
|
||||
@Test(groups = "live", singleThreaded = true)
|
||||
public class AWSKeyPairClientLiveTest {
|
||||
|
||||
private AWSKeyPairClient client;
|
||||
|
@ -120,7 +120,7 @@ public class AWSKeyPairClientLiveTest {
|
|||
|
||||
TemplateOptions options = computeContext.getComputeService().templateOptions();
|
||||
|
||||
options.authorizePublicKey(keyPair.get("public")).as(AWSEC2TemplateOptions.class).spotPrice(0.3f);
|
||||
options.authorizePublicKey(keyPair.get("public")).as(AWSEC2TemplateOptions.class);
|
||||
|
||||
ComputeServiceContext noSshContext = null;
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue