From 31d5d0b514907c473e24d0ef8deef8af0441d67a Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 15 Mar 2012 16:33:48 -0700 Subject: [PATCH] temporary fix to CloudLinux blow-up --- .../src/main/java/org/jclouds/compute/domain/OsFamily.java | 2 +- .../softlayer/compute/functions/ProductItemToImage.java | 3 +++ .../softlayer/compute/functions/ProductItemToImageTest.java | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) 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 f1565e2d26..3d855dd758 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/OsFamily.java +++ b/compute/src/main/java/org/jclouds/compute/domain/OsFamily.java @@ -45,7 +45,7 @@ public enum OsFamily { SCIENTIFIC, SIGAR, SLACKWARE, - SOLARIS, SUSE, TURBOLINUX, UBUNTU, WINDOWS; + SOLARIS, SUSE, TURBOLINUX, CLOUD_LINUX, UBUNTU, WINDOWS; public String value() { return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()); } diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/ProductItemToImage.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/ProductItemToImage.java index e931e57759..20d863b876 100644 --- a/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/ProductItemToImage.java +++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/ProductItemToImage.java @@ -54,6 +54,7 @@ public class ProductItemToImage implements Function { private static final String RHEL = "Red Hat Enterprise Linux"; private static final String UBUNTU = "Ubuntu Linux"; private static final String WINDOWS = "Windows Server"; + private static final String CLOUD_LINUX = "CloudLinux"; @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) @@ -96,6 +97,7 @@ public class ProductItemToImage implements Function { else if(description.startsWith(RHEL)) return OsFamily.RHEL; else if(description.startsWith(UBUNTU)) return OsFamily.UBUNTU; else if(description.startsWith(WINDOWS)) return OsFamily.WINDOWS; + else if(description.startsWith(CLOUD_LINUX)) return OsFamily.CLOUD_LINUX; return OsFamily.UNRECOGNIZED; } }; @@ -120,6 +122,7 @@ public class ProductItemToImage implements Function { else if(family.equals(OsFamily.RHEL)) return parseVersion(description, RHEL); else if(family.equals(OsFamily.UBUNTU)) return parseVersion(description, UBUNTU); else if(family.equals(OsFamily.WINDOWS)) return parseVersion(description, WINDOWS); + else if(family.equals(OsFamily.CLOUD_LINUX)) return parseVersion(description, CLOUD_LINUX); else throw new NoSuchElementException("No os version for item:"+productItem); } }; diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/ProductItemToImageTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/ProductItemToImageTest.java index aca1585859..17c9fcb009 100644 --- a/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/ProductItemToImageTest.java +++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/ProductItemToImageTest.java @@ -40,7 +40,7 @@ import static org.testng.AssertJUnit.*; */ @Test(groups = "unit") public class ProductItemToImageTest { - // Operating Systems available SEPT 2011 + // Operating Systems available MAR 2012 private static final List operatingSystems = Arrays.asList( "CentOS 5 - LAMP Install (32 bit)", "CentOS 5 - LAMP Install (64 bit)", @@ -77,6 +77,8 @@ public class ProductItemToImageTest { "Ubuntu Linux 8 LTS Hardy Heron - LAMP Install (64 bit)", "Ubuntu Linux 8 LTS Hardy Heron - Minimal Install (32 bit)", "Ubuntu Linux 8 LTS Hardy Heron - Minimal Install (64 bit)", + "CloudLinux 6 (32 bit)", + "CloudLinux 6 (64 bit)", "Windows Server 2003 Datacenter SP2 with R2 (32 bit)", "Windows Server 2003 Datacenter SP2 with R2 (64 bit)", "Windows Server 2003 Enterprise SP2 with R2 (64 bit)",