Sha256: 2ad0eed5b243af3b62b4a88962cd5bb8aa13b1f7940c4daeb0b19519b8fb00ba

Contents?: true

Size: 1.35 KB

Versions: 8

Compression:

Stored size: 1.35 KB

Contents

require "kitchen/driver/aws/standard_platform"

module Kitchen
  module Driver
    class Aws
      class StandardPlatform
        # https://wiki.debian.org/Cloud/AmazonEC2Image
        class Debian < StandardPlatform
          StandardPlatform.platforms["debian"] = self

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

          def username
            "admin"
          end

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

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

          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
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kitchen-ec2-1.3.2 lib/kitchen/driver/aws/standard_platform/debian.rb
kitchen-ec2-1.3.1 lib/kitchen/driver/aws/standard_platform/debian.rb
kitchen-ec2-1.3.0 lib/kitchen/driver/aws/standard_platform/debian.rb
kitchen-ec2-1.2.0 lib/kitchen/driver/aws/standard_platform/debian.rb
kitchen-ec2-1.1.0 lib/kitchen/driver/aws/standard_platform/debian.rb
kitchen-ec2-1.0.1 lib/kitchen/driver/aws/standard_platform/debian.rb
kitchen-ec2-1.0.0 lib/kitchen/driver/aws/standard_platform/debian.rb
kitchen-ec2-1.0.0.beta.1 lib/kitchen/driver/aws/standard_platform/debian.rb