Class: Kitchen::Driver::Aws::StandardPlatform::Debian

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

Overview

Constant Summary collapse

DEBIAN_CODENAMES =
{
  "8" => "jessie",
  "7" => "wheezy",
  "6" => "squeeze"
}

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

ARCHITECTURE

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, #initialize, platforms, #to_s

Constructor Details

This class inherits a constructor from Kitchen::Driver::Aws::StandardPlatform

Class Method Details

.from_image(driver, image) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/kitchen/driver/aws/standard_platform/debian.rb', line 34

def self.from_image(driver, image)
  if image.name =~ /debian/i
    image.name =~ /\b(\d+|#{DEBIAN_CODENAMES.values.join("|")})\b/i
    version = (Regexp.last_match || [])[1]
    if version && version.to_i == 0
      version = DEBIAN_CODENAMES.find do |_v, codename|
        codename == version.downcase
      end.first
    end
    new(driver, "debian", version, image.architecture)
  end
end

Instance Method Details

#codenameObject



21
22
23
# File 'lib/kitchen/driver/aws/standard_platform/debian.rb', line 21

def codename
  version ? DEBIAN_CODENAMES[version] : DEBIAN_CODENAMES.values.first
end

#image_searchObject



25
26
27
28
29
30
31
32
# File 'lib/kitchen/driver/aws/standard_platform/debian.rb', line 25

def image_search
  search = {
    "owner-id" => "379101102735",
    "name" => "debian-#{codename}-*"
  }
  search["architecture"] = architecture if architecture
  search
end

#usernameObject



17
18
19
# File 'lib/kitchen/driver/aws/standard_platform/debian.rb', line 17

def username
  "admin"
end