diff --git a/compute/src/main/java/org/jclouds/compute/domain/OsFamily.java b/compute/src/main/java/org/jclouds/compute/domain/OsFamily.java index bcd533539f..f1565e2d26 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/OsFamily.java +++ b/compute/src/main/java/org/jclouds/compute/domain/OsFamily.java @@ -38,7 +38,14 @@ public enum OsFamily { * * Oracle Enterprise Linux */ - OEL, OPENBSD, RHEL, SIGAR, SOLARIS, SUSE, TURBOLINUX, UBUNTU, WINDOWS; + OEL, OPENBSD, RHEL, + /** + * Scientific Linux + */ + SCIENTIFIC, + SIGAR, + SLACKWARE, + SOLARIS, SUSE, TURBOLINUX, UBUNTU, WINDOWS; public String value() { return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); } diff --git a/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java b/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java index b597ff4717..a776344632 100644 --- a/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java +++ b/compute/src/main/java/org/jclouds/compute/reference/ComputeServiceConstants.java @@ -91,7 +91,7 @@ public interface ComputeServiceConstants { @Inject(optional = true) @Named(PROPERTY_OS_VERSION_MAP_JSON) // TODO: switch this to read from resource, failing back to string constant on classpath problem - public String osVersionMapJson = "{\"suse\":{\"\":\"\",\"11\":\"11\",\"11 SP1\":\"11 SP1\"},\"debian\":{\"\":\"\",\"lenny\":\"5.0\",\"squeeze\":\"6.0\"},\"centos\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\",\"5.6\":\"5.6\",\"5.7\":\"5.7\",\"6\":\"6.0\",\"6.0\":\"6.0\"},\"rhel\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\",\"5.6\":\"5.6\",\"5.7\":\"5.7\",\"6\":\"6.0\",\"6.0\":\"6.0\"},\"solaris\":{\"\":\"\",\"10\":\"10\"},\"ubuntu\":{\"\":\"\",\"hardy\":\"8.04\",\"karmic\":\"9.10\",\"lucid\":\"10.04\",\"10.04.1\":\"10.04\",\"maverick\":\"10.10\",\"natty\":\"11.04\",\"oneiric\":\"11.10\",\"precise\":\"12.04\"},\"windows\":{\"\":\"\",\"7\":\"7\",\"2003\":\"2003\",\"2003 Standard\":\"2003\",\"2003 R2\":\"2003 R2\",\"2008\":\"2008\",\"2008 Web\":\"2008\",\"2008 Server\":\"2008\",\"Server 2008\":\"2008\",\"2008 R1\":\"2008 R1\",\"2008 R2\":\"2008 R2\",\"Server 2008 R2\":\"2008 R2\",\"2008 Server R2\":\"2008 R2\",\"2008 SP2\":\"2008 SP2\",\"Server 2008 SP2\":\"2008 SP2\"}}"; + public String osVersionMapJson = "{\"suse\":{\"\":\"\",\"11\":\"11\",\"11 SP1\":\"11 SP1\"},\"debian\":{\"\":\"\",\"lenny\":\"5.0\",\"6\":\"6.0\",\"squeeze\":\"6.0\"},\"centos\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\",\"5.6\":\"5.6\",\"5.7\":\"5.7\",\"6\":\"6.0\",\"6.0\":\"6.0\"},\"rhel\":{\"\":\"\",\"5\":\"5.0\",\"5.2\":\"5.2\",\"5.3\":\"5.3\",\"5.4\":\"5.4\",\"5.5\":\"5.5\",\"5.6\":\"5.6\",\"5.7\":\"5.7\",\"6\":\"6.0\",\"6.0\":\"6.0\"},\"solaris\":{\"\":\"\",\"10\":\"10\"},\"ubuntu\":{\"\":\"\",\"hardy\":\"8.04\",\"karmic\":\"9.10\",\"lucid\":\"10.04\",\"10.04.1\":\"10.04\",\"maverick\":\"10.10\",\"natty\":\"11.04\",\"oneiric\":\"11.10\",\"precise\":\"12.04\"},\"windows\":{\"\":\"\",\"7\":\"7\",\"2003\":\"2003\",\"2003 Standard\":\"2003\",\"2003 R2\":\"2003 R2\",\"2008\":\"2008\",\"2008 Web\":\"2008\",\"2008 Server\":\"2008\",\"Server 2008\":\"2008\",\"2008 R1\":\"2008 R1\",\"2008 R2\":\"2008 R2\",\"Server 2008 R2\":\"2008 R2\",\"2008 Server R2\":\"2008 R2\",\"2008 SP2\":\"2008 SP2\",\"Server 2008 SP2\":\"2008 SP2\"}}"; } @Singleton diff --git a/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java b/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java index 73b264614f..5882377725 100644 --- a/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java +++ b/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java @@ -103,7 +103,7 @@ public class GleSYSComputeServiceAdapter implements ComputeServiceAdapter { Builder builder = OperatingSystem.builder(); builder.name(template.getName()).description(template.getName()).is64Bit(parsed.is64Bit).version(parsed.version) .family(parsed.family); - return new ImageBuilder().ids(template.getName()).description(template.getName()) - .operatingSystem(builder.build()).build(); + return new ImageBuilder().ids(template.getName()).name(template.getName()).description(template.getName()) + .operatingSystem(builder.build()).build(); } } diff --git a/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/compute/functions/ParseOsFamilyVersion64BitFromImageName.java b/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/compute/functions/ParseOsFamilyVersion64BitFromImageName.java index 847d5d825d..1076b08147 100644 --- a/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/compute/functions/ParseOsFamilyVersion64BitFromImageName.java +++ b/sandbox-providers/glesys/src/main/java/org/jclouds/glesys/compute/functions/ParseOsFamilyVersion64BitFromImageName.java @@ -34,8 +34,8 @@ import org.jclouds.compute.util.ComputeServiceUtils; import com.google.common.base.Function; /** - * Defaults to version null and 64bit, if the operating system is unrecognized and the pattern - * "32bit" isn't in the string. + * Defaults to version null and 64bit, if the operating system is unrecognized + * and the pattern "32bit" isn't in the string. * * @author Adrian Cole * @@ -51,24 +51,43 @@ public class ParseOsFamilyVersion64BitFromImageName implements Function of(new Log4JLoggingModule(), new SshjSshClientModule())); - assertEquals(context.getComputeService().listAssignableLocations().size(), 6); + assertEquals(context.getComputeService().listAssignableLocations().size(), 4); } finally { if (context != null) diff --git a/sandbox-providers/glesys/src/test/java/org/jclouds/glesys/compute/GleSYSTemplateBuilderLiveTest.java b/sandbox-providers/glesys/src/test/java/org/jclouds/glesys/compute/GleSYSTemplateBuilderLiveTest.java index d2566550a7..fe644358f2 100644 --- a/sandbox-providers/glesys/src/test/java/org/jclouds/glesys/compute/GleSYSTemplateBuilderLiveTest.java +++ b/sandbox-providers/glesys/src/test/java/org/jclouds/glesys/compute/GleSYSTemplateBuilderLiveTest.java @@ -55,20 +55,24 @@ public class GleSYSTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { @Override public boolean apply(OsFamilyVersion64Bit input) { - // TODO: this is an incomplete list until ParseOsFamilyVersion64BitFromImageName is - // complete switch (input.family) { - case UBUNTU: - return (input.version.equals("")|| input.version.equals("11.04")) && input.is64Bit; - case DEBIAN: - return input.version.equals("") || input.version.matches("[56].0"); - case FEDORA: - return input.version.equals("") || input.version.equals("13") || input.version.equals("15"); - case CENTOS: - return input.version.equals("") || input.version.equals("5") || input.version.equals("5.0") - || input.version.equals("6.0"); - default: - return false; + case UBUNTU: + return input.version.equals("") + || input.version.equals("10.04") + || ((input.version.equals("8.04") || input.version.equals("11.04") || input.version + .equals("10.10")) && input.is64Bit); + case DEBIAN: + return input.version.equals("") || input.version.matches("[56].0"); + case FEDORA: + return input.version.equals("") || input.version.equals("13") || input.version.equals("15"); + case CENTOS: + return input.version.equals("") || input.version.equals("5") || input.version.equals("5.5") + || input.version.equals("5.0") || input.version.equals("6.0"); + case WINDOWS: + return input.version.equals("") || input.version.equals("2008") + || (input.version.equals("2008 R2") && input.is64Bit); + default: + return false; } } @@ -78,7 +82,7 @@ public class GleSYSTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { @Test public void testDefaultTemplateBuilder() throws IOException { Template defaultTemplate = context.getComputeService().templateBuilder().build(); - assertEquals(defaultTemplate.getImage().getId(), "11.04"); + assertEquals(defaultTemplate.getImage().getId(), "Ubuntu 11.04 x64"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.04"); assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); @@ -93,6 +97,6 @@ public class GleSYSTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { @Override protected Set getIso3166Codes() { - return ImmutableSet. of("NL-NH","SE-N","US-NY","SE-AB"); + return ImmutableSet. of("NL-NH", "SE-N", "US-NY", "SE-AB"); } } \ No newline at end of file diff --git a/sandbox-providers/glesys/src/test/resources/osmatches.json b/sandbox-providers/glesys/src/test/resources/osmatches.json index 42b165f7cc..47360332e9 100644 --- a/sandbox-providers/glesys/src/test/resources/osmatches.json +++ b/sandbox-providers/glesys/src/test/resources/osmatches.json @@ -4,12 +4,21 @@ "version": "5.0", "is64Bit": false }, - "Centos 5 64-bit": { "family": "CENTOS", "version": "5.0", "is64Bit": true }, + "CentOS 5.5 x64": { + "family": "CENTOS", + "version": "5.5", + "is64Bit": true + }, + "CentOS 5.5 x86": { + "family": "CENTOS", + "version": "5.5", + "is64Bit": false + }, "Centos 6 32-bit": { "family": "CENTOS", "version": "6.0", @@ -20,6 +29,16 @@ "version": "6.0", "is64Bit": true }, + "Centos 6 x64": { + "family": "CENTOS", + "version": "6.0", + "is64Bit": true + }, + "Centos 6 x86": { + "family": "CENTOS", + "version": "6.0", + "is64Bit": false + }, "Debian 5.0": { "family": "DEBIAN", "version": "5.0", @@ -30,6 +49,11 @@ "version": "5.0", "is64Bit": true }, + "Debian 5.0.1 x64": { + "family": "DEBIAN", + "version": "5.0", + "is64Bit": true + }, "Debian 6.0 32-bit": { "family": "DEBIAN", "version": "6.0", @@ -40,9 +64,104 @@ "version": "6.0", "is64Bit": true }, + "Debian-6 x64": { + "family": "DEBIAN", + "version": "6.0", + "is64Bit": true + }, + "Fedora Core 11": { + "family": "FEDORA", + "version": "", + "is64Bit": false + }, + "Fedora Core 11 64-bit": { + "family": "FEDORA", + "version": "", + "is64Bit": true + }, + "FreeBSD 8.2": { + "family": "FREEBSD", + "version": "", + "is64Bit": false + }, + "Gentoo": { + "family": "GENTOO", + "version": "", + "is64Bit": false + }, + "Gentoo 10.1 x64": { + "family": "GENTOO", + "version": "", + "is64Bit": true + }, + "Gentoo 64-bit": { + "family": "GENTOO", + "version": "", + "is64Bit": true + }, + "Scientific Linux 6": { + "family": "SCIENTIFIC", + "version": "", + "is64Bit": false + }, + "Scientific Linux 6 64-bit": { + "family": "SCIENTIFIC", + "version": "", + "is64Bit": true + }, + "Slackware 12": { + "family": "SLACKWARE", + "version": "", + "is64Bit": false + }, + "Ubuntu 10.04 LTS 32-bit": { + "family": "UBUNTU", + "version": "10.04", + "is64Bit": false + }, + "Ubuntu 10.04 LTS 64-bit": { + "family": "UBUNTU", + "version": "10.04", + "is64Bit": true + }, + "Ubuntu 10.10 x64": { + "family": "UBUNTU", + "version": "10.10", + "is64Bit": true + }, "Ubuntu 11.04 64-bit": { "family": "UBUNTU", "version": "11.04", "is64Bit": true + }, + "Ubuntu 11.04 x64": { + "family": "UBUNTU", + "version": "11.04", + "is64Bit": true + }, + "Ubuntu 8.04 x64": { + "family": "UBUNTU", + "version": "8.04", + "is64Bit": true + }, + "Windows Server 2008 R2 x64 std": { + "family": "WINDOWS", + "version": "2008 R2", + "is64Bit": true + }, + "Windows Server 2008 R2 x64 web": { + "family": "WINDOWS", + "version": "2008 R2", + "is64Bit": true + }, + "Windows Server 2008 x64 web": { + "family": "WINDOWS", + "version": "2008", + "is64Bit": true + }, + "Windows Server 2008 x86 web": { + "family": "WINDOWS", + "version": "2008", + "is64Bit": false } } \ No newline at end of file