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 =

10/11 are listed last since we default to the first item in the hash and 10/11 are not released yet. When they’re released move them up

{
  9 => "stretch",
  8 => "jessie",
  7 => "wheezy",
  6 => "squeeze",
  11 => "bullseye",
  10 => "buster",
}.freeze

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

Constructor Details

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

Class Method Details

.from_image(driver, image) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/kitchen/driver/aws/standard_platform/debian.rb', line 59

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



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

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



50
51
52
53
54
55
56
57
# File 'lib/kitchen/driver/aws/standard_platform/debian.rb', line 50

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

#usernameObject



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

def username
  "admin"
end