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 =
{
  13 => "trixie",
  12 => "bookworm",
  11 => "bullseye",
  10 => "buster",
  9 => "stretch",
  8 => "jessie",
  7 => "wheezy",
  6 => "squeeze",
}.freeze

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

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

Constructor Details

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

Class Method Details

.from_image(driver, image) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/kitchen/driver/aws/standard_platform/debian.rb', line 73

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

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

Instance Method Details

#codenameObject



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

def codename
  v = version
  if v && v.size > 1
    warn("WARN: Debian version #{version} specified, but searching for #{version.to_i} instead.")
    v = v.to_i
  end
  v ? DEBIAN_CODENAMES[v.to_i] : DEBIAN_CODENAMES.values.first
end

#image_searchObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/kitchen/driver/aws/standard_platform/debian.rb', line 52

def image_search
  search = {}

  # The Debian AWS owner ID changed for releases 10 and onwards
  # See https://wiki.debian.org/Amazon/EC2/HowTo/awscli
  if version.nil?
    search["owner-id"] = "136693071363"
    search["name"] = "debian-#{DEBIAN_CODENAMES.keys.first}-*"
  elsif version.to_i >= 10
    search["owner-id"] = "136693071363"
    search["name"] = "debian-#{version.to_i}-*"
  else
    search["owner-id"] = "379101102735"
    search["name"] = "debian-#{codename}-*"
  end

  search["architecture"] = architecture if architecture

  search
end

#usernameString

default username for this platform’s ami

Returns:

  • (String)


39
40
41
# File 'lib/kitchen/driver/aws/standard_platform/debian.rb', line 39

def username
  "admin"
end