lib/kitchen/driver/aws/standard_platform/rhel.rb in kitchen-ec2-3.17.0 vs lib/kitchen/driver/aws/standard_platform/rhel.rb in kitchen-ec2-3.17.1

- old
+ new

@@ -30,11 +30,11 @@ end # default username for this platform's ami # @return [String] def username - (version && version.to_f < 6.4) ? "root" : "ec2-user" + version && version.to_f < 6.4 ? "root" : "ec2-user" end def image_search search = { "owner-id" => "309956199498", @@ -43,13 +43,13 @@ search["architecture"] = architecture if architecture search end def self.from_image(driver, image) - if /rhel/i.match?(image.name) - image.name =~ /\b(\d+(\.\d+)?)/i - new(driver, "rhel", (Regexp.last_match || [])[1], image.architecture) - end + return unless /rhel/i.match?(image.name) + + image.name =~ /\b(\d+(\.\d+)?)/i + new(driver, "rhel", (Regexp.last_match || [])[1], image.architecture) end def sort_by_version(images) # First do a normal version sort super(images)