Class: Kitchen::Driver::Aws::StandardPlatform::Centos
Overview
Constant Summary
ARCHITECTURE
Instance Attribute Summary
#architecture, #driver, #name, #version
Class Method Summary
collapse
Instance Method Summary
collapse
#find_image, from_platform_string, #initialize, platforms, #to_s
Class Method Details
.from_image(driver, image) ⇒ Object
36
37
38
39
40
41
|
# File 'lib/kitchen/driver/aws/standard_platform/centos.rb', line 36
def self.from_image(driver, image)
if image.name =~ /centos/i
image.name =~ /\b(\d+(\.\d+)?)\b/i
new(driver, "centos", (Regexp.last_match || [])[1], image.architecture)
end
end
|
Instance Method Details
#image_search ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/kitchen/driver/aws/standard_platform/centos.rb', line 18
def image_search
search = {
"owner-alias" => "aws-marketplace",
"name" => ["CentOS Linux #{version}*", "CentOS-#{version}*-GA-*"]
}
search["architecture"] = architecture if architecture
search
end
|
#sort_by_version(images) ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/kitchen/driver/aws/standard_platform/centos.rb', line 27
def sort_by_version(images)
images.group_by { |image| self.class.from_image(driver, image).version }.
sort_by { |k, _v| (k && k.include?(".") ? k.to_f : "#{k}.999".to_f) }.
reverse.map { |_k, v| v }.flatten(1)
end
|
#username ⇒ Object
11
12
13
14
15
16
|
# File 'lib/kitchen/driver/aws/standard_platform/centos.rb', line 11
def username
return "root" if version && version.start_with?("6.")
"centos"
end
|