Class: Kitchen::Driver::Aws::StandardPlatform::Windows
- Inherits:
-
Kitchen::Driver::Aws::StandardPlatform
- Object
- Kitchen::Driver::Aws::StandardPlatform
- Kitchen::Driver::Aws::StandardPlatform::Windows
- Defined in:
- lib/kitchen/driver/aws/standard_platform/windows.rb
Overview
Constant Summary
Constants inherited from Kitchen::Driver::Aws::StandardPlatform
Instance Attribute Summary
Attributes inherited from Kitchen::Driver::Aws::StandardPlatform
#architecture, #driver, #name, #version
Class Method Summary collapse
Instance Method Summary collapse
-
#image_search ⇒ Object
Figure out the right set of names to search for:.
- #sort_by_version(images) ⇒ Object
- #username ⇒ Object
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
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/kitchen/driver/aws/standard_platform/windows.rb', line 50 def self.from_image(driver, image) if image.name =~ /Windows/i # 2008 R2 SP2 if image.name =~ /(\b\d+)\W*(r\d+)?/i major, revision = (Regexp.last_match || [])[1], (Regexp.last_match || [])[2] if image.name =~ /(sp\d+|rtm)/i service_pack = (Regexp.last_match || [])[1] end revision = revision.downcase if revision service_pack ||= "rtm" service_pack = service_pack.downcase version = "#{major}#{revision}#{service_pack}" end new(driver, "windows", version, image.architecture) end end |
Instance Method Details
#image_search ⇒ Object
Figure out the right set of names to search for:
"windows" -> [nil, nil, nil] Windows_Server--R_RTM-, Windows_Server--R_SP*-, Windows_Server--RTM-, Windows_Server--SP*- "windows-2012" -> [2012, 0, nil] Windows_Server-2012-RTM-, Windows_Server-2012-SP*- "windows-2012r2" -> [2012, 2, nil] Windows_Server-2012-R2_RTM-, Windows_Server-2012-R2_SP*- "windows-2012sp1" -> [2012, 0, 1] Windows_Server-2012-SP1- "windows-2012rtm" -> [2012, 0, 0] Windows_Server-2012-RTM- "windows-2012r2sp1" -> [2012, 2, 1] Windows_Server-2012-R2_SP1- "windows-2012r2rtm" -> [2012, 2, 0] Windows_Server-2012-R2_RTM-
32 33 34 35 36 37 38 39 |
# File 'lib/kitchen/driver/aws/standard_platform/windows.rb', line 32 def image_search search = { "owner-alias" => "amazon", "name" => windows_name_filter } search["architecture"] = architecture if architecture search end |
#sort_by_version(images) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/kitchen/driver/aws/standard_platform/windows.rb', line 41 def sort_by_version(images) # 2008r2rtm -> [ img1, img2, img3 ] # 2012r2sp1 -> [ img4, img5 ] # ... images.group_by { |image| self.class.from_image(driver, image).windows_version_parts }. sort_by { |version, _platform_images| version }. reverse.map { |_version, platform_images| platform_images }.flatten(1) end |
#username ⇒ Object
11 12 13 |
# File 'lib/kitchen/driver/aws/standard_platform/windows.rb', line 11 def username "administrator" end |