Class: Kitchen::Driver::Aws::StandardPlatform::Alma

Inherits:
StandardPlatform
  • Object
show all
Defined in:
lib/kitchen/driver/aws/standard_platform/alma.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_image(driver, image) ⇒ Alma?

Detect this platform from an EC2 image.

Matching is done on the image name, which is the only reliable signal EC2 exposes about what an AMI actually contains.

Parameters:

  • driver (Kitchen::Driver::Ec2)

    the driver requesting detection

  • image (Aws::EC2::Image)

    the image to inspect

Returns:

  • (Alma, nil)

    a platform when the image is AlmaLinux, otherwise nil



78
79
80
81
82
83
# File 'lib/kitchen/driver/aws/standard_platform/alma.rb', line 78

def self.from_image(driver, image)
  return unless /AlmaLinux OS/i.match?(image.name)

  image.name =~ /\b(\d+(\.\d+)?)\b/i
  new(driver, "alma", (Regexp.last_match || [])[1], image.architecture)
end

Instance Method Details

#image_searchHash{String => String, Array<String>}

EC2 image filters that select AlmaLinux OS images published by the AlmaLinux project.

A filter is added for Kitchen::Driver::Aws::StandardPlatform#architecture only when one was requested, so that an unspecified architecture matches any of them.

Returns:

  • (Hash{String => String, Array<String>})

    filter name to the value or values it must match

See Also:



44
45
46
47
48
49
50
51
# File 'lib/kitchen/driver/aws/standard_platform/alma.rb', line 44

def image_search
  search = {
    "owner-id" => "764336703387",
    "name" => version ? "AlmaLinux OS #{version}*" : "AlmaLinux OS *",
  }
  search["architecture"] = architecture if architecture
  search
end

#sort_by_version(images) ⇒ Array<Aws::EC2::Image>

Sort images newest release first, keeping Kitten builds last.

AlmaLinux Kitten is AlmaLinux's development distribution, published from the same account and under the same "AlmaLinux OS" prefix as the releases. Its name carries no release number, so from_image reads the major straight into the build date: "AlmaLinux OS Kitten 10.20260727.0" yields "10.20260727", a far larger number than the "10.2" of an actual release, which sorts Kitten ahead of everything. A versioned search is unaffected, since "AlmaLinux OS 10*" does not match "AlmaLinux OS Kitten 10*".

Parameters:

  • images (Array<Aws::EC2::Image>)

    the images to sort

Returns:

  • (Array<Aws::EC2::Image>)

    the images, newest release first



66
67
68
# File 'lib/kitchen/driver/aws/standard_platform/alma.rb', line 66

def sort_by_version(images)
  prefer(super) { |image| !image.name.include?("Kitten") }
end

#usernameString

The account EC2 creates on this platform's official AMIs.

Used as the SSH username when the transport does not specify one.

Returns:

  • (String)

    the default SSH username



32
33
34
# File 'lib/kitchen/driver/aws/standard_platform/alma.rb', line 32

def username
  "ec2-user"
end