Class: Kitchen::Driver::Aws::StandardPlatform::El

Inherits:
Kitchen::Driver::Aws::StandardPlatform show all
Defined in:
lib/kitchen/driver/aws/standard_platform/rhel.rb

Overview

Constant Summary

Constants inherited from Kitchen::Driver::Aws::StandardPlatform

SUPPORTED_ARCHITECTURES

Instance Attribute Summary

Attributes inherited from Kitchen::Driver::Aws::StandardPlatform

#architecture, #driver, #name, #version

Class Method Summary collapse

Instance Method Summary collapse

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



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

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

Instance Method Details

#image_searchObject



36
37
38
39
40
41
42
43
# File 'lib/kitchen/driver/aws/standard_platform/rhel.rb', line 36

def image_search
  search = {
    "owner-id" => "309956199498",
    "name" => "RHEL-#{version}*",
  }
  search["architecture"] = architecture if architecture
  search
end

#usernameObject



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

def username
  (version && version.to_f < 6.4) ? "root" : "ec2-user"
end