21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/sambot/chef/kitchen.rb', line 21
def generate_yml(cookbook_name, platforms, suites = nil)
raise ApplicationError, 'Missing platforms when trying to generate Test-Kitchen YAML.' unless platforms
raise ApplicationError, 'Missing cookbook name when trying to generate Test-Kitchen YAML.' unless cookbook_name
test_kitchen_configs = {
"#{LOCAL}": read_template(LOCAL, cookbook_name, platforms),
"#{GCP}": read_template(GCP, cookbook_name, platforms),
"#{RACKSPACE}": read_template(RACKSPACE, cookbook_name, platforms)
}
test_kitchen_configs.each do |key, value|
if suites
value['suites'] = Marshal.load(Marshal.dump(suites))
case key.to_s
when LOCAL
add_platform_identifier(value, 'LOCAL')
when GCP
add_platform_identifier(value, 'GCP')
when RACKSPACE
add_platform_identifier(value, 'RACKSPACE')
end
end
test_kitchen_configs[key] = value.to_yaml
end
test_kitchen_configs
end
|