mirror of https://github.com/apache/jclouds.git
Issue 624:update terremark config to use ubuntu 10.04 templates
This commit is contained in:
parent
f945398068
commit
2506b8c581
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.vcloud.terremark.compute.config;
|
package org.jclouds.vcloud.terremark.compute.config;
|
||||||
|
|
||||||
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
|
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
@ -31,7 +29,6 @@ import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.compute.config.BindComputeStrategiesByClass;
|
import org.jclouds.compute.config.BindComputeStrategiesByClass;
|
||||||
import org.jclouds.compute.config.BindComputeSuppliersByClass;
|
import org.jclouds.compute.config.BindComputeSuppliersByClass;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.domain.TemplateBuilder;
|
|
||||||
import org.jclouds.compute.options.TemplateOptions;
|
import org.jclouds.compute.options.TemplateOptions;
|
||||||
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
import org.jclouds.compute.strategy.PopulateDefaultLoginCredentialsForImageStrategy;
|
||||||
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
|
import org.jclouds.vcloud.compute.VCloudExpressComputeClient;
|
||||||
|
@ -48,7 +45,6 @@ import org.jclouds.vcloud.terremark.compute.strategy.ParseVAppTemplateDescriptio
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.inject.Injector;
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
@ -72,12 +68,6 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudExpressCom
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// prefer jeos as the copy time is much shorter
|
|
||||||
@Override
|
|
||||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
|
||||||
return template.osFamily(UBUNTU).osDescriptionMatches(".*JeOS.*").os64Bit(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
super.configure();
|
super.configure();
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.jclouds.compute.domain.Template;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,30 +47,29 @@ public class TerremarkVCloudExpressTemplateBuilderLiveTest extends BaseTemplateB
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
|
||||||
return new Predicate<OsFamilyVersion64Bit>() {
|
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(OsFamilyVersion64Bit input) {
|
public boolean apply(OsFamilyVersion64Bit input) {
|
||||||
switch (input.family) {
|
switch (input.family) {
|
||||||
case RHEL:
|
case RHEL:
|
||||||
return !input.version.equals("") && !input.version.equals("5.0");
|
return input.version.equals("") || input.version.equals("5.0");
|
||||||
case CENTOS:
|
case CENTOS:
|
||||||
return !input.version.equals("") && !input.version.matches("5.0");
|
return input.version.equals("") || input.version.equals("5.0");
|
||||||
case UBUNTU:
|
case UBUNTU:
|
||||||
return !input.version.equals("") && !(input.version.equals("9.04") || input.version.equals("9.10"));
|
return input.version.equals("") || input.version.matches("9.[10][04]") || input.version.equals("10.04");
|
||||||
case WINDOWS:
|
case WINDOWS:
|
||||||
return !input.version.equals("") && !input.version.equals("2003") //
|
return input.version.equals("") || input.version.equals("2003") || input.version.equals("2008");
|
||||||
&& !input.version.equals("2008");
|
|
||||||
default:
|
default:
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultTemplateBuilder() throws IOException {
|
public void testDefaultTemplateBuilder() throws IOException {
|
||||||
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
Template defaultTemplate = context.getComputeService().templateBuilder().build();
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "9.10");
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||||
|
|
Loading…
Reference in New Issue