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
|
// from stopping->stopped state on an ec2 micro
|
||||||
properties.setProperty(PROPERTY_TIMEOUT_NODE_SUSPENDED, 120 * 1000 + "");
|
properties.setProperty(PROPERTY_TIMEOUT_NODE_SUSPENDED, 120 * 1000 + "");
|
||||||
// auth fail sometimes happens in EC2, as the rc.local script that injects the
|
// 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
|
// authorized key executes after ssh has started.
|
||||||
// starts after package updates, which means that this value can be higher.
|
properties.setProperty("jclouds.ssh.max-retries", "7");
|
||||||
properties.setProperty("jclouds.ssh.max-retries", "10");
|
|
||||||
properties.setProperty("jclouds.ssh.retry-auth", "true");
|
properties.setProperty("jclouds.ssh.retry-auth", "true");
|
||||||
properties.setProperty(PROPERTY_ENDPOINT, "https://ec2.us-east-1.amazonaws.com");
|
properties.setProperty(PROPERTY_ENDPOINT, "https://ec2.us-east-1.amazonaws.com");
|
||||||
properties.putAll(Region.regionProperties());
|
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.config.BaseComputeServiceContextModule;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.TemplateBuilder;
|
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.EC2BindComputeStrategiesByClass;
|
||||||
import org.jclouds.ec2.compute.config.EC2BindComputeSuppliersByClass;
|
import org.jclouds.ec2.compute.config.EC2BindComputeSuppliersByClass;
|
||||||
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;
|
||||||
import org.jclouds.ec2.compute.internal.EC2TemplateBuilderImpl;
|
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.predicates.InstancePresent;
|
||||||
import org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions;
|
import org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions;
|
||||||
import org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet;
|
import org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet;
|
||||||
|
@ -103,4 +105,16 @@ public class AWSEC2ComputeServiceContextModule extends BaseComputeServiceContext
|
||||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
||||||
return template.osFamily(AMZN_LINUX).os64Bit(true);
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,8 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
|
||||||
|
|
||||||
startedId = Iterables.getOnlyElement(nodes).getProviderId();
|
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.getKeyName(), group);
|
||||||
assertEquals(instance.getMonitoringState(), MonitoringState.ENABLED);
|
assertEquals(instance.getMonitoringState(), MonitoringState.ENABLED);
|
||||||
|
@ -160,8 +161,9 @@ public class AWSEC2ComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
|
||||||
+ instance.getRegion(), group));
|
+ instance.getRegion(), group));
|
||||||
|
|
||||||
// make sure our dummy group has no rules
|
// make sure our dummy group has no rules
|
||||||
SecurityGroup secgroup = Iterables.getOnlyElement(securityGroupClient.describeSecurityGroupsInRegion(null,
|
SecurityGroup secgroup = Iterables.getOnlyElement(securityGroupClient.describeSecurityGroupsInRegion(instance
|
||||||
"jclouds#" + group + "#" + instance.getRegion()));
|
.getRegion(), "jclouds#" + group + "#" + instance.getRegion()));
|
||||||
|
|
||||||
assert secgroup.getIpPermissions().size() == 0 : secgroup;
|
assert secgroup.getIpPermissions().size() == 0 : secgroup;
|
||||||
|
|
||||||
// try to run a script with the original keyPair
|
// try to run a script with the original keyPair
|
||||||
|
|
|
@ -65,7 +65,7 @@ import com.google.inject.Module;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@Test(groups = "live", sequential = true)
|
@Test(groups = "live", singleThreaded = true)
|
||||||
public class AWSKeyPairClientLiveTest {
|
public class AWSKeyPairClientLiveTest {
|
||||||
|
|
||||||
private AWSKeyPairClient client;
|
private AWSKeyPairClient client;
|
||||||
|
@ -120,7 +120,7 @@ public class AWSKeyPairClientLiveTest {
|
||||||
|
|
||||||
TemplateOptions options = computeContext.getComputeService().templateOptions();
|
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;
|
ComputeServiceContext noSshContext = null;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue