Class: Kitchen::Driver::Aws::StandardPlatform::Fedora

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

Overview

Constant Summary collapse

DEVELOPMENT_STREAMS =

Name fragments marking an image as a development stream rather than a Fedora release: Rawhide (the rolling development branch), ELN (Enterprise Linux Next) and the Prerelease builds published while a release is still stabilising.

/-(?:Rawhide|ELN|Prerelease)-/i

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_image(driver, image) ⇒ Fedora?

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:

  • (Fedora, nil)

    a platform when the image is Fedora, otherwise nil



90
91
92
93
94
95
# File 'lib/kitchen/driver/aws/standard_platform/fedora.rb', line 90

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

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

Instance Method Details

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

EC2 image filters that select Fedora Cloud Base images.

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:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/kitchen/driver/aws/standard_platform/fedora.rb', line 49

def image_search
  search = {
    "owner-id" => "125523088429",
    "name" => if version
                # Both naming schemes are searched because the older
                # one is still present in some regions.
                ["Fedora-Cloud-Base-AmazonEC2.*-#{version}-*",
                 "Fedora-Cloud-Base-#{version}-*"]
              else
                "Fedora-Cloud-Base-*"
              end,
  }
  search["architecture"] = architecture if architecture
  search
end

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

Sort images newest release first, keeping development streams last.

Fedora publishes Rawhide, ELN and Prerelease images from the same account and under the same "Fedora-Cloud-Base-" prefix as its releases. Those names carry a build date where a release carries a release number, so from_image reads a version like "20250820.0" off them -- larger than any real release, which sorts them to the front. They are pushed to the back afterwards, the same way RHEL handles its Beta images.

Parameters:

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

    the images to sort

Returns:

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

    the images, newest release first



77
78
79
80
# File 'lib/kitchen/driver/aws/standard_platform/fedora.rb', line 77

def sort_by_version(images)
  images = super
  prefer(images) { |image| !DEVELOPMENT_STREAMS.match?(image.name) }
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



37
38
39
# File 'lib/kitchen/driver/aws/standard_platform/fedora.rb', line 37

def username
  "fedora"
end