Class: Kitchen::Driver::Aws::StandardPlatform::El
- Inherits:
-
Kitchen::Driver::Aws::StandardPlatform
- Object
- Kitchen::Driver::Aws::StandardPlatform
- Kitchen::Driver::Aws::StandardPlatform::El
- Defined in:
- lib/kitchen/driver/aws/standard_platform/rhel.rb
Overview
Constant Summary
Constants inherited from Kitchen::Driver::Aws::StandardPlatform
Instance Attribute Summary
Attributes inherited from Kitchen::Driver::Aws::StandardPlatform
#architecture, #driver, #name, #version
Class Method Summary collapse
Instance Method Summary collapse
- #image_search ⇒ Object
-
#initialize(driver, _name, version, architecture) ⇒ El
constructor
A new instance of El.
- #sort_by_version(images) ⇒ Object
-
#username ⇒ String
default username for this platform’s ami.
Methods inherited from Kitchen::Driver::Aws::StandardPlatform
#find_image, from_platform_string, platforms, #to_s
Constructor Details
#initialize(driver, _name, version, architecture) ⇒ El
Returns a new instance of El.
27 28 29 30 |
# File 'lib/kitchen/driver/aws/standard_platform/rhel.rb', line 27 def initialize(driver, _name, version, architecture) # rhel = el super(driver, "rhel", version, architecture) end |
Class Method Details
.from_image(driver, image) ⇒ Object
47 48 49 50 51 52 |
# File 'lib/kitchen/driver/aws/standard_platform/rhel.rb', line 47 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 end |
Instance Method Details
#image_search ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/kitchen/driver/aws/standard_platform/rhel.rb', line 38 def image_search search = { "owner-id" => "309956199498", "name" => "RHEL-#{version}*", } search["architecture"] = architecture if architecture search end |
#sort_by_version(images) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/kitchen/driver/aws/standard_platform/rhel.rb', line 54 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 |
#username ⇒ String
default username for this platform’s ami
34 35 36 |
# File 'lib/kitchen/driver/aws/standard_platform/rhel.rb', line 34 def username (version && version.to_f < 6.4) ? "root" : "ec2-user" end |