jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Downer (JIRA)" <j...@apache.org>
Subject [jira] [Created] (JCLOUDS-1351) AWS CentOS marketplace AMI misdetecting OS type
Date Thu, 02 Nov 2017 12:29:00 GMT
Richard Downer created JCLOUDS-1351:

             Summary: AWS CentOS marketplace AMI misdetecting OS type
                 Key: JCLOUDS-1351
                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1351
             Project: jclouds
          Issue Type: Bug
          Components: jclouds-compute
    Affects Versions: 2.0.2
            Reporter: Richard Downer
            Priority: Minor

When jclouds encounters an official CentOS Linux AMI from the AWS Marketplace, it detects
the operating system as "unrecognized".

To reproduce, set the {{jclouds.ec2.ami-query}} / {{jclouds.ec2.cc-ami-query}} properties
to search the AWS Marketplace for CentOS images. Example: {{owner-id=679593333241;state=available;image-type=machine;root-device-type=ebs;architecture=x86_64;virtualization-type=hvm;name=CentOS
Linux *}}

jclouds will discover from AWS AMIs such as this one:

    <imageLocation>aws-marketplace/CentOS Linux 7 x86_64 HVM EBS 1704_01-b7ee8a69-ee97-4a49-9e68-afaee216db2e-ami-d52f5bc3.4</imageLocation>
    <name>CentOS Linux 7 x86_64 HVM EBS 1704_01-b7ee8a69-ee97-4a49-9e68-afaee216db2e-ami-d52f5bc3.4</name>
    <description>CentOS Linux 7 x86_64 HVM EBS 1704_01</description>

While parsing this, execution will end up here: https://github.com/jclouds/jclouds/blob/574c7fc3c1234037608c8daf96375673265e904f/compute/src/main/java/org/jclouds/compute/util/ComputeServiceUtils.java#L141

   public static org.jclouds.compute.domain.OsFamily parseOsFamilyOrUnrecognized(String in)
      org.jclouds.compute.domain.OsFamily myOs = null;
      for (org.jclouds.compute.domain.OsFamily os : org.jclouds.compute.domain.OsFamily.values())
         if (in.toLowerCase().replaceAll("\\s", "").indexOf(os.toString()) != -1) {
            myOs = os;
      return myOs != null ? myOs : OsFamily.UNRECOGNIZED;

This enumerates over the known OS names to see if there's a match in the AMI name. The string
{{CentOS Linux 7 x86_64 HVM EBS 1704_01-b7ee8a69-ee97-4a49-9e68-afaee216db2e-ami-d52f5bc3.4}}
contains matches two enum values: *CENTOS* and *LINUX*. It seems that the alphabetically-last
value is the one that is selected, so that this method returns LINUX and not CENTOS.

This message was sent by Atlassian JIRA

View raw message