Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.0.2
-
None
Description
I have an image in my AWS EC2 account with this metadata:
Image [architecture=X86_64, description=null, ebsBlockDevices=
{/dev/sda1=EbsBlockDevice [deleteOnTermination=false, snapshotId=snap-0f1dbc42eb5353012, volumeSize=8, volumeType=null, iops=null, encrypted=false]}, imageId=ami-dc667dba, imageLocation=449550055360/CentOS 7 x86_64 repacked by Richard, imageOwnerId=449550055360, imageState=available, imageType=MACHINE, isPublic=false, kernelId=null, name=CentOS 7 x86_64 repacked by Richard, platform=null, productCodes=[aw0evgkw8e5c1q413zgy5pjce], ramdiskId=null, region=eu-west-1, rootDeviceName=/dev/sda1, rootDeviceType=ebs, virtualizationType=hvm, hypervisor=xen, tags=
{group=random}]
jclouds is detecting this as version 5, not version 7.
The reason for this appears to be ComputeServiceUtils.parseVersionOrReturnEmptyString. This is being invoked from EC2ImageParser with the argument 449550055360/CentOS 7 x86_64 repacked by Richard. This function searches for a number that might be a version, and if it finds it, applies it to the OS metadata builder.
In this case, it is matching one of the 5 digits and thinking that my image is CentOS 5.
EC2ImageParser is providing imageLocation as the method's argument, which is a combination of the owning account ID and the name. A simple solution to this problem might be to use the name field instead.
However I wonder if the parseVersionOrReturnEmptyString method should be a bit smarter and not attempt to use a number if it appears in the middle of a group of numbers.