lib/kitchen/driver/aws/standard_platform/rhel.rb in kitchen-ec2-3.7.1 vs lib/kitchen/driver/aws/standard_platform/rhel.rb in kitchen-ec2-3.7.2

- old
+ new

@@ -43,13 +43,20 @@ search["architecture"] = architecture if architecture search end def self.from_image(driver, image) - if image.name =~ /rhel/i + if /rhel/i.match?(image.name) image.name =~ /\b(\d+(\.\d+)?)/i new(driver, "rhel", (Regexp.last_match || [])[1], image.architecture) end + end + + def sort_by_version(images) + # First do a normal version sort + super(images) + # Now sort again, shunning Beta releases. + prefer(images) { |image| !image.name.match(/_Beta-/i) } end end end end end