9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/fog/openstack/models/orchestration/templates.rb', line 9
def get(obj)
data = if obj.is_a?(Stack)
service.get_stack_template(obj).body
else
service.show_resource_template(obj.resource_name).body
end
if data.has_key?('AWSTemplateFormatVersion')
data['content'] = data.to_json
data['format'] = 'CFN'
data['template_version'] = data.delete('AWSTemplateFormatVersion')
data['description'] = data.delete('Description')
data['parameter'] = data.delete('Parameters')
data['resources'] = data.delete('Resources')
else
data['content'] = data.to_yaml
data['format'] = 'HOT'
data['template_version'] = data.delete('heat_template_version')
end
new(data)
rescue Fog::Compute::OpenStack::NotFound
nil
end
|