merge.py --hot to process and generate HOT
This adds a --hot flag to merge.py which will assume source templates are in the HOT format, and generate a HOT template artifact. Tests have also been ported to HOT, along with some minor corrections to the existing tests to make the source and result templates valid heat templates. Partial-Blueprint: tripleo-juno-remove-mergepy Change-Id: If18ff79f89456123c884a1ab2f910ce4cc9a6e0b
This commit is contained in:
parent
998c5dda9c
commit
d1d829e6ac
@ -1,3 +1,4 @@
|
||||
HeatTemplateFormatVersion: '2012-12-12'
|
||||
Parameters:
|
||||
A:
|
||||
Type: String
|
||||
|
24
examples/launchconfig1_hot.yaml
Normal file
24
examples/launchconfig1_hot.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
heat_template_version: 2013-05-23
|
||||
parameters:
|
||||
A:
|
||||
type: string
|
||||
default: test1
|
||||
B:
|
||||
type: string
|
||||
default: test2
|
||||
resource1Image:
|
||||
type: string
|
||||
default: resource1
|
||||
resources:
|
||||
notcomputeConfigBase:
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
metadata:
|
||||
OpenStack::Role: notcomputeConfig
|
||||
a: {get_param: A}
|
||||
b: {get_param: B}
|
||||
resource1:
|
||||
type: OS::Nova::Server
|
||||
properties:
|
||||
flavor: test_flavor
|
||||
image: {get_param: resource1Image}
|
||||
key_name: test_key
|
@ -1,3 +1,4 @@
|
||||
HeatTemplateFormatVersion: '2012-12-12'
|
||||
Parameters:
|
||||
C:
|
||||
Type: String
|
||||
|
20
examples/launchconfig2_hot.yaml
Normal file
20
examples/launchconfig2_hot.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
heat_template_version: 2013-05-23
|
||||
parameters:
|
||||
C:
|
||||
type: string
|
||||
default: test3
|
||||
resource2Image:
|
||||
type: string
|
||||
default: resource2
|
||||
resources:
|
||||
notcomputeConfigMixin:
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
metadata:
|
||||
OpenStack::Role: notcomputeConfig
|
||||
c: {get_param: C}
|
||||
resource2:
|
||||
type: OS::Nova::Server
|
||||
properties:
|
||||
flavor: test_flavor
|
||||
image: {get_param: resource2Image}
|
||||
key_name: test_key
|
43
examples/launchconfig_result_hot.yaml
Normal file
43
examples/launchconfig_result_hot.yaml
Normal file
@ -0,0 +1,43 @@
|
||||
description: examples/launchconfig1_hot.yaml,examples/launchconfig2_hot.yaml
|
||||
heat_template_version: '2013-05-23'
|
||||
parameters:
|
||||
A:
|
||||
default: test1
|
||||
type: string
|
||||
B:
|
||||
default: test2
|
||||
type: string
|
||||
C:
|
||||
default: test3
|
||||
type: string
|
||||
resource1Image:
|
||||
default: resource1
|
||||
type: string
|
||||
resource2Image:
|
||||
default: resource2
|
||||
type: string
|
||||
resources:
|
||||
notcomputeConfig:
|
||||
metadata:
|
||||
OpenStack::Role: notcomputeConfig
|
||||
a:
|
||||
get_param: A
|
||||
b:
|
||||
get_param: B
|
||||
c:
|
||||
get_param: C
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
resource1:
|
||||
properties:
|
||||
flavor: test_flavor
|
||||
image:
|
||||
get_param: resource1Image
|
||||
key_name: test_key
|
||||
type: OS::Nova::Server
|
||||
resource2:
|
||||
properties:
|
||||
flavor: test_flavor
|
||||
image:
|
||||
get_param: resource2Image
|
||||
key_name: test_key
|
||||
type: OS::Nova::Server
|
13
examples/lib_hot.yaml
Normal file
13
examples/lib_hot.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
parameters:
|
||||
ImportantValue:
|
||||
default: a_default
|
||||
type: string
|
||||
BImage:
|
||||
type: string
|
||||
resources:
|
||||
GenericB:
|
||||
type: OS::Nova::Server
|
||||
properties:
|
||||
image: {get_param: BImage}
|
||||
metadata:
|
||||
my_meta: {get_param: ImportantValue}
|
@ -1,3 +1,4 @@
|
||||
HeatTemplateFormatVersion: '2012-12-12'
|
||||
Resources:
|
||||
ComputeUser:
|
||||
Type: AWS::IAM::User
|
||||
|
32
examples/scale1_hot.yaml
Normal file
32
examples/scale1_hot.yaml
Normal file
@ -0,0 +1,32 @@
|
||||
heat_template_version: 2013-05-23
|
||||
resources:
|
||||
ComputeUser:
|
||||
type: AWS::IAM::User
|
||||
properties:
|
||||
Policies: [ { get_param: ComputeAccessPolicy } ]
|
||||
GlobalAccessPolicy:
|
||||
type: OS::Heat::AccessPolicy
|
||||
NovaCompute0Key:
|
||||
type: FileInclude
|
||||
Path: examples/scale2_hot.yaml
|
||||
SubKey: resources.NovaCompute0Key
|
||||
NovaCompute0CompletionCondition:
|
||||
type: FileInclude
|
||||
Path: examples/scale2_hot.yaml
|
||||
SubKey: resources.NovaCompute0CompletionCondition
|
||||
NovaCompute0CompletionHandle:
|
||||
type: FileInclude
|
||||
Path: examples/scale2_hot.yaml
|
||||
SubKey: resources.NovaCompute0CompletionHandle
|
||||
NovaCompute0Config:
|
||||
type: FileInclude
|
||||
Path: examples/scale2_hot.yaml
|
||||
SubKey: resources.NovaCompute0Config
|
||||
parameters:
|
||||
ComputeImage: "123"
|
||||
RabbitUserName: "guest"
|
||||
RabbitPassword: "guest"
|
||||
NovaCompute0:
|
||||
type: FileInclude
|
||||
Path: examples/scale2_hot.yaml
|
||||
SubKey: resources.NovaCompute0
|
69
examples/scale2_hot.yaml
Normal file
69
examples/scale2_hot.yaml
Normal file
@ -0,0 +1,69 @@
|
||||
heat_template_version: 2013-05-23
|
||||
parameters:
|
||||
ComputeImage:
|
||||
type: string
|
||||
RabbitUserName:
|
||||
type: string
|
||||
RabbitPassword:
|
||||
type: string
|
||||
hidden: true
|
||||
resources:
|
||||
ComputeAccessPolicy:
|
||||
type: OS::Heat::AccessPolicy
|
||||
properties:
|
||||
AllowedResources: [ NovaCompute0 ]
|
||||
NovaCompute0Key:
|
||||
type: AWS::IAM::AccessKey
|
||||
properties:
|
||||
UserName:
|
||||
get_param: ComputeUser
|
||||
NovaCompute0CompletionCondition:
|
||||
type: AWS::CloudFormation::WaitCondition
|
||||
depends_on: notcompute
|
||||
properties:
|
||||
Handle: {get_resource: NovaCompute0CompletionHandle}
|
||||
Count: '1'
|
||||
Timeout: '1800'
|
||||
NovaCompute0CompletionHandle:
|
||||
type: AWS::CloudFormation::WaitConditionHandle
|
||||
NovaCompute0:
|
||||
type: OS::Nova::Server
|
||||
properties:
|
||||
image:
|
||||
get_param: ComputeImage
|
||||
metadata:
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute0Key
|
||||
secret_access_key:
|
||||
get_attr: [ NovaCompute0Key, SecretAccessKey ]
|
||||
stack_name: {get_param: 'AWS::StackName'}
|
||||
path: NovaCompute0Config.Metadata
|
||||
NovaCompute0Config:
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
metadata:
|
||||
completion-handle:
|
||||
get_resource: NovaCompute0CompletionHandle
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute0Key
|
||||
secret_access_key:
|
||||
get_attr: [ NovaCompute0Key, SecretAccessKey ]
|
||||
stack_name: {get_param: 'AWS::StackName'}
|
||||
path: NovaCompute0Config.Metadata
|
||||
neutron:
|
||||
ovs:
|
||||
local_ip:
|
||||
Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- networks
|
||||
rabbit:
|
||||
username: {get_param: RabbitUserName}
|
||||
password: {get_param: RabbitPassword}
|
||||
|
@ -1,3 +1,4 @@
|
||||
HeatTemplateFormatVersion: '2012-12-12'
|
||||
Resources:
|
||||
ComputeUser:
|
||||
Type: AWS::IAM::User
|
||||
|
54
examples/scale_map2_hot.yaml
Normal file
54
examples/scale_map2_hot.yaml
Normal file
@ -0,0 +1,54 @@
|
||||
heat_template_version: 2013-05-23
|
||||
parameters:
|
||||
AllHosts:
|
||||
type: string
|
||||
ComputeImage:
|
||||
type: string
|
||||
resources:
|
||||
ComputeAccessPolicy:
|
||||
type: OS::Heat::AccessPolicy
|
||||
properties:
|
||||
AllowedResources: [ NovaCompute0 ]
|
||||
NovaCompute0Key:
|
||||
type: AWS::IAM::AccessKey
|
||||
properties:
|
||||
UserName:
|
||||
get_param: ComputeUser
|
||||
NovaCompute0CompletionCondition:
|
||||
type: AWS::CloudFormation::WaitCondition
|
||||
depends_on: notcompute
|
||||
properties:
|
||||
Handle: {get_resource: NovaCompute0CompletionHandle}
|
||||
Count: '1'
|
||||
Timeout: '1800'
|
||||
NovaCompute0CompletionHandle:
|
||||
type: AWS::CloudFormation::WaitConditionHandle
|
||||
NovaCompute0:
|
||||
type: OS::Nova::Server
|
||||
properties:
|
||||
image:
|
||||
get_param: ComputeImage
|
||||
metadata:
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute0Key
|
||||
secret_access_key:
|
||||
get_attr: [ NovaCompute0Key, SecretAccessKey ]
|
||||
stack_name: {get_param: 'AWS::StackName'}
|
||||
path: NovaCompute0Config.Metadata
|
||||
NovaCompute0Config:
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
metadata:
|
||||
completion-handle:
|
||||
get_resource: NovaCompute0CompletionHandle
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute0Key
|
||||
secret_access_key:
|
||||
get_attr: [ NovaCompute0Key, SecretAccessKey ]
|
||||
stack_name: {get_param: 'AWS::StackName'}
|
||||
path: NovaCompute0Config.Metadata
|
||||
hosts:
|
||||
get_param: AllHosts
|
56
examples/scale_map_hot.yaml
Normal file
56
examples/scale_map_hot.yaml
Normal file
@ -0,0 +1,56 @@
|
||||
heat_template_version: 2013-05-23
|
||||
resources:
|
||||
ComputeUser:
|
||||
type: AWS::IAM::User
|
||||
properties:
|
||||
Policies: [ { get_param: ComputeAccessPolicy } ]
|
||||
GlobalAccessPolicy:
|
||||
type: OS::Heat::AccessPolicy
|
||||
NovaCompute0Key:
|
||||
type: FileInclude
|
||||
Path: examples/scale_map2_hot.yaml
|
||||
SubKey: resources.NovaCompute0Key
|
||||
NovaCompute0CompletionCondition:
|
||||
type: FileInclude
|
||||
Path: examples/scale_map2_hot.yaml
|
||||
SubKey: resources.NovaCompute0CompletionCondition
|
||||
NovaCompute0CompletionHandle:
|
||||
type: FileInclude
|
||||
Path: examples/scale_map2_hot.yaml
|
||||
SubKey: resources.NovaCompute0CompletionHandle
|
||||
NovaCompute0Config:
|
||||
type: FileInclude
|
||||
Path: examples/scale_map2_hot.yaml
|
||||
SubKey: resources.NovaCompute0Config
|
||||
parameters:
|
||||
AllHosts:
|
||||
list_join:
|
||||
- "\n"
|
||||
- Merge::Map:
|
||||
NovaCompute0:
|
||||
list_join:
|
||||
- ' '
|
||||
- - Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- networks
|
||||
- Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- show
|
||||
- list_join:
|
||||
- '.'
|
||||
- - Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- show
|
||||
- 'local'
|
||||
NovaCompute0:
|
||||
type: FileInclude
|
||||
Path: examples/scale_map2_hot.yaml
|
||||
SubKey: resources.NovaCompute0
|
367
examples/scale_map_result_hot.yaml
Normal file
367
examples/scale_map_result_hot.yaml
Normal file
@ -0,0 +1,367 @@
|
||||
description: examples/scale_map_hot.yaml
|
||||
heat_template_version: '2013-05-23'
|
||||
resources:
|
||||
ComputeUser:
|
||||
properties:
|
||||
Policies:
|
||||
- get_param: ComputeAccessPolicy
|
||||
type: AWS::IAM::User
|
||||
GlobalAccessPolicy:
|
||||
type: OS::Heat::AccessPolicy
|
||||
NovaCompute0:
|
||||
metadata:
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute0Key
|
||||
path: NovaCompute0Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute0Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
properties:
|
||||
image:
|
||||
get_param: ComputeImage
|
||||
type: OS::Nova::Server
|
||||
NovaCompute0CompletionCondition:
|
||||
depends_on: notcompute
|
||||
properties:
|
||||
Count: '1'
|
||||
Handle:
|
||||
get_resource: NovaCompute0CompletionHandle
|
||||
Timeout: '1800'
|
||||
type: AWS::CloudFormation::WaitCondition
|
||||
NovaCompute0CompletionHandle:
|
||||
type: AWS::CloudFormation::WaitConditionHandle
|
||||
NovaCompute0Config:
|
||||
metadata:
|
||||
completion-handle:
|
||||
get_resource: NovaCompute0CompletionHandle
|
||||
hosts:
|
||||
list_join:
|
||||
- '
|
||||
|
||||
'
|
||||
- - list_join:
|
||||
- ' '
|
||||
- - Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- networks
|
||||
- Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- show
|
||||
- list_join:
|
||||
- .
|
||||
- - Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- show
|
||||
- local
|
||||
- list_join:
|
||||
- ' '
|
||||
- - Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute1
|
||||
- networks
|
||||
- Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute1
|
||||
- show
|
||||
- list_join:
|
||||
- .
|
||||
- - Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute1
|
||||
- show
|
||||
- local
|
||||
- list_join:
|
||||
- ' '
|
||||
- - Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute2
|
||||
- networks
|
||||
- Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute2
|
||||
- show
|
||||
- list_join:
|
||||
- .
|
||||
- - Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute2
|
||||
- show
|
||||
- local
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute0Key
|
||||
path: NovaCompute0Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute0Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
NovaCompute0Key:
|
||||
properties:
|
||||
UserName:
|
||||
get_param: ComputeUser
|
||||
type: AWS::IAM::AccessKey
|
||||
NovaCompute1:
|
||||
metadata:
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute1Key
|
||||
path: NovaCompute1Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute1Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
properties:
|
||||
image:
|
||||
get_param: ComputeImage
|
||||
type: OS::Nova::Server
|
||||
NovaCompute1CompletionCondition:
|
||||
depends_on: notcompute
|
||||
properties:
|
||||
Count: '1'
|
||||
Handle:
|
||||
get_resource: NovaCompute1CompletionHandle
|
||||
Timeout: '1800'
|
||||
type: AWS::CloudFormation::WaitCondition
|
||||
NovaCompute1CompletionHandle:
|
||||
type: AWS::CloudFormation::WaitConditionHandle
|
||||
NovaCompute1Config:
|
||||
metadata:
|
||||
completion-handle:
|
||||
get_resource: NovaCompute1CompletionHandle
|
||||
hosts:
|
||||
list_join:
|
||||
- '
|
||||
|
||||
'
|
||||
- - list_join:
|
||||
- ' '
|
||||
- - Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- networks
|
||||
- Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- show
|
||||
- list_join:
|
||||
- .
|
||||
- - Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- show
|
||||
- local
|
||||
- list_join:
|
||||
- ' '
|
||||
- - Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute1
|
||||
- networks
|
||||
- Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute1
|
||||
- show
|
||||
- list_join:
|
||||
- .
|
||||
- - Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute1
|
||||
- show
|
||||
- local
|
||||
- list_join:
|
||||
- ' '
|
||||
- - Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute2
|
||||
- networks
|
||||
- Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute2
|
||||
- show
|
||||
- list_join:
|
||||
- .
|
||||
- - Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute2
|
||||
- show
|
||||
- local
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute1Key
|
||||
path: NovaCompute1Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute1Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
NovaCompute1Key:
|
||||
properties:
|
||||
UserName:
|
||||
get_param: ComputeUser
|
||||
type: AWS::IAM::AccessKey
|
||||
NovaCompute2:
|
||||
metadata:
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute2Key
|
||||
path: NovaCompute2Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute2Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
properties:
|
||||
image:
|
||||
get_param: ComputeImage
|
||||
type: OS::Nova::Server
|
||||
NovaCompute2CompletionCondition:
|
||||
depends_on: notcompute
|
||||
properties:
|
||||
Count: '1'
|
||||
Handle:
|
||||
get_resource: NovaCompute2CompletionHandle
|
||||
Timeout: '1800'
|
||||
type: AWS::CloudFormation::WaitCondition
|
||||
NovaCompute2CompletionHandle:
|
||||
type: AWS::CloudFormation::WaitConditionHandle
|
||||
NovaCompute2Config:
|
||||
metadata:
|
||||
completion-handle:
|
||||
get_resource: NovaCompute2CompletionHandle
|
||||
hosts:
|
||||
list_join:
|
||||
- '
|
||||
|
||||
'
|
||||
- - list_join:
|
||||
- ' '
|
||||
- - Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- networks
|
||||
- Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- show
|
||||
- list_join:
|
||||
- .
|
||||
- - Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- show
|
||||
- local
|
||||
- list_join:
|
||||
- ' '
|
||||
- - Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute1
|
||||
- networks
|
||||
- Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute1
|
||||
- show
|
||||
- list_join:
|
||||
- .
|
||||
- - Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute1
|
||||
- show
|
||||
- local
|
||||
- list_join:
|
||||
- ' '
|
||||
- - Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute2
|
||||
- networks
|
||||
- Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute2
|
||||
- show
|
||||
- list_join:
|
||||
- .
|
||||
- - Fn::Select:
|
||||
- name
|
||||
- get_attr:
|
||||
- NovaCompute2
|
||||
- show
|
||||
- local
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute2Key
|
||||
path: NovaCompute2Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute2Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
NovaCompute2Key:
|
||||
properties:
|
||||
UserName:
|
||||
get_param: ComputeUser
|
||||
type: AWS::IAM::AccessKey
|
193
examples/scale_result_hot.yaml
Normal file
193
examples/scale_result_hot.yaml
Normal file
@ -0,0 +1,193 @@
|
||||
description: examples/scale1_hot.yaml
|
||||
heat_template_version: '2013-05-23'
|
||||
resources:
|
||||
ComputeUser:
|
||||
properties:
|
||||
Policies:
|
||||
- get_param: ComputeAccessPolicy
|
||||
type: AWS::IAM::User
|
||||
GlobalAccessPolicy:
|
||||
type: OS::Heat::AccessPolicy
|
||||
NovaCompute0:
|
||||
metadata:
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute0Key
|
||||
path: NovaCompute0Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute0Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
properties:
|
||||
image:
|
||||
get_param: ComputeImage
|
||||
type: OS::Nova::Server
|
||||
NovaCompute0CompletionCondition:
|
||||
depends_on: notcompute
|
||||
properties:
|
||||
Count: '1'
|
||||
Handle:
|
||||
get_resource: NovaCompute0CompletionHandle
|
||||
Timeout: '1800'
|
||||
type: AWS::CloudFormation::WaitCondition
|
||||
NovaCompute0CompletionHandle:
|
||||
type: AWS::CloudFormation::WaitConditionHandle
|
||||
NovaCompute0Config:
|
||||
metadata:
|
||||
completion-handle:
|
||||
get_resource: NovaCompute0CompletionHandle
|
||||
neutron:
|
||||
ovs:
|
||||
local_ip:
|
||||
Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute0
|
||||
- networks
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute0Key
|
||||
path: NovaCompute0Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute0Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
rabbit:
|
||||
password: guest
|
||||
username: guest
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
NovaCompute0Key:
|
||||
properties:
|
||||
UserName:
|
||||
get_param: ComputeUser
|
||||
type: AWS::IAM::AccessKey
|
||||
NovaCompute1:
|
||||
metadata:
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute1Key
|
||||
path: NovaCompute1Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute1Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
properties:
|
||||
image:
|
||||
get_param: ComputeImage
|
||||
type: OS::Nova::Server
|
||||
NovaCompute1CompletionCondition:
|
||||
depends_on: notcompute
|
||||
properties:
|
||||
Count: '1'
|
||||
Handle:
|
||||
get_resource: NovaCompute1CompletionHandle
|
||||
Timeout: '1800'
|
||||
type: AWS::CloudFormation::WaitCondition
|
||||
NovaCompute1CompletionHandle:
|
||||
type: AWS::CloudFormation::WaitConditionHandle
|
||||
NovaCompute1Config:
|
||||
metadata:
|
||||
completion-handle:
|
||||
get_resource: NovaCompute1CompletionHandle
|
||||
neutron:
|
||||
ovs:
|
||||
local_ip:
|
||||
Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute1
|
||||
- networks
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute1Key
|
||||
path: NovaCompute1Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute1Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
rabbit:
|
||||
password: guest
|
||||
username: guest
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
NovaCompute1Key:
|
||||
properties:
|
||||
UserName:
|
||||
get_param: ComputeUser
|
||||
type: AWS::IAM::AccessKey
|
||||
NovaCompute2:
|
||||
metadata:
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute2Key
|
||||
path: NovaCompute2Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute2Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
properties:
|
||||
image:
|
||||
get_param: ComputeImage
|
||||
type: OS::Nova::Server
|
||||
NovaCompute2CompletionCondition:
|
||||
depends_on: notcompute
|
||||
properties:
|
||||
Count: '1'
|
||||
Handle:
|
||||
get_resource: NovaCompute2CompletionHandle
|
||||
Timeout: '1800'
|
||||
type: AWS::CloudFormation::WaitCondition
|
||||
NovaCompute2CompletionHandle:
|
||||
type: AWS::CloudFormation::WaitConditionHandle
|
||||
NovaCompute2Config:
|
||||
metadata:
|
||||
completion-handle:
|
||||
get_resource: NovaCompute2CompletionHandle
|
||||
neutron:
|
||||
ovs:
|
||||
local_ip:
|
||||
Fn::Select:
|
||||
- 0
|
||||
- Fn::Select:
|
||||
- ctlplane
|
||||
- get_attr:
|
||||
- NovaCompute2
|
||||
- networks
|
||||
os-collect-config:
|
||||
cfn:
|
||||
access_key_id:
|
||||
get_resource: NovaCompute2Key
|
||||
path: NovaCompute2Config.Metadata
|
||||
secret_access_key:
|
||||
get_attr:
|
||||
- NovaCompute2Key
|
||||
- SecretAccessKey
|
||||
stack_name:
|
||||
get_param: AWS::StackName
|
||||
rabbit:
|
||||
password: guest
|
||||
username: guest
|
||||
type: AWS::AutoScaling::LaunchConfiguration
|
||||
NovaCompute2Key:
|
||||
properties:
|
||||
UserName:
|
||||
get_param: ComputeUser
|
||||
type: AWS::IAM::AccessKey
|
@ -1,7 +1,8 @@
|
||||
HeatTemplateFormatVersion: '2012-12-12'
|
||||
Parameters:
|
||||
SourceImage:
|
||||
Type: String
|
||||
Default: my_image
|
||||
Type: String
|
||||
Default: my_image
|
||||
Resources:
|
||||
A:
|
||||
Type: OS::Nova::Server
|
||||
|
4
examples/source2_hot.yaml
Normal file
4
examples/source2_hot.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
__include__:
|
||||
path: examples/lib_hot.yaml
|
||||
params:
|
||||
ImportantValue: Foo
|
16
examples/source2_lib_result_hot.yaml
Normal file
16
examples/source2_lib_result_hot.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
description: examples/source2_hot.yaml
|
||||
heat_template_version: '2013-05-23'
|
||||
parameters:
|
||||
BImage:
|
||||
type: string
|
||||
ImportantValue:
|
||||
default: a_default
|
||||
type: string
|
||||
resources:
|
||||
GenericB:
|
||||
metadata:
|
||||
my_meta: Foo
|
||||
properties:
|
||||
image:
|
||||
get_param: BImage
|
||||
type: OS::Nova::Server
|
16
examples/source_hot.yaml
Normal file
16
examples/source_hot.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
heat_template_version: 2013-05-23
|
||||
parameters:
|
||||
SourceImage:
|
||||
type: string
|
||||
default: my_image
|
||||
resources:
|
||||
A:
|
||||
type: OS::Nova::Server
|
||||
properties:
|
||||
image: {get_param: SourceImage}
|
||||
B:
|
||||
type: FileInclude
|
||||
Path: examples/lib_hot.yaml
|
||||
SubKey: resources.GenericB
|
||||
parameters:
|
||||
ImportantValue: {list_join: [ '', ['one', 'two', 'three']]}
|
@ -1,3 +1,4 @@
|
||||
HeatTemplateFormatVersion: '2012-12-12'
|
||||
Parameters:
|
||||
Foo:
|
||||
Type: String
|
||||
|
11
examples/source_include_subkey_hot.yaml
Normal file
11
examples/source_include_subkey_hot.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
heat_template_version: 2013-05-23
|
||||
parameters:
|
||||
Foo:
|
||||
type: string
|
||||
resources:
|
||||
__include__:
|
||||
path: examples/lib_hot.yaml
|
||||
subkey: resources
|
||||
params:
|
||||
BImage:
|
||||
get_param: Foo
|
14
examples/source_include_subkey_result_hot.yaml
Normal file
14
examples/source_include_subkey_result_hot.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
description: examples/source_include_subkey_hot.yaml
|
||||
heat_template_version: '2013-05-23'
|
||||
parameters:
|
||||
Foo:
|
||||
type: string
|
||||
resources:
|
||||
GenericB:
|
||||
metadata:
|
||||
my_meta:
|
||||
get_param: ImportantValue
|
||||
properties:
|
||||
image:
|
||||
get_param: Foo
|
||||
type: OS::Nova::Server
|
@ -1,9 +1,9 @@
|
||||
Description: examples/source.yaml
|
||||
HeatTemplateFormatVersion: '2012-12-12'
|
||||
Parameters:
|
||||
Default: my_image
|
||||
SourceImage: null
|
||||
Type: String
|
||||
SourceImage:
|
||||
Default: my_image
|
||||
Type: String
|
||||
Resources:
|
||||
A:
|
||||
Properties:
|
||||
|
24
examples/source_lib_result_hot.yaml
Normal file
24
examples/source_lib_result_hot.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
description: examples/source_hot.yaml
|
||||
heat_template_version: '2013-05-23'
|
||||
parameters:
|
||||
SourceImage:
|
||||
default: my_image
|
||||
type: string
|
||||
resources:
|
||||
A:
|
||||
properties:
|
||||
image:
|
||||
get_param: SourceImage
|
||||
type: OS::Nova::Server
|
||||
B:
|
||||
metadata:
|
||||
my_meta:
|
||||
list_join:
|
||||
- ''
|
||||
- - one
|
||||
- two
|
||||
- three
|
||||
properties:
|
||||
image:
|
||||
get_param: BImage
|
||||
type: OS::Nova::Server
|
@ -30,6 +30,12 @@ run_test "python $merge_py examples/source_include_subkey.yaml" examples/source_
|
||||
run_test "python $merge_py examples/launchconfig1.yaml examples/launchconfig2.yaml" examples/launchconfig_result.yaml
|
||||
run_test "python $merge_py --scale NovaCompute=3 examples/scale1.yaml" examples/scale_result.yaml
|
||||
run_test "python $merge_py --scale NovaCompute=3 examples/scale_map.yaml" examples/scale_map_result.yaml
|
||||
run_test "python $merge_py --hot examples/source_hot.yaml" examples/source_lib_result_hot.yaml
|
||||
run_test "python $merge_py --hot examples/source2_hot.yaml" examples/source2_lib_result_hot.yaml
|
||||
run_test "python $merge_py --hot examples/source_include_subkey_hot.yaml" examples/source_include_subkey_result_hot.yaml
|
||||
run_test "python $merge_py --hot examples/launchconfig1_hot.yaml examples/launchconfig2_hot.yaml" examples/launchconfig_result_hot.yaml
|
||||
run_test "python $merge_py --hot --scale NovaCompute=3 examples/scale1_hot.yaml" examples/scale_result_hot.yaml
|
||||
run_test "python $merge_py --hot --scale NovaCompute=3 examples/scale_map_hot.yaml" examples/scale_map_result_hot.yaml
|
||||
echo
|
||||
trap - EXIT
|
||||
exit $fail
|
||||
|
@ -23,6 +23,25 @@ class Cfn(object):
|
||||
get_attr = 'Fn::GetAtt'
|
||||
|
||||
|
||||
class Hot(object):
|
||||
|
||||
base_template = {
|
||||
'heat_template_version': '2013-05-23',
|
||||
'description': []
|
||||
}
|
||||
get_resource = 'get_resource'
|
||||
get_param = 'get_param'
|
||||
description = 'description'
|
||||
parameters = 'parameters'
|
||||
outputs = 'outputs'
|
||||
resources = 'resources'
|
||||
type = 'type'
|
||||
properties = 'properties'
|
||||
metadata = 'metadata'
|
||||
depends_on = 'depends_on'
|
||||
get_attr = 'get_attr'
|
||||
|
||||
|
||||
lang = Cfn()
|
||||
|
||||
|
||||
@ -241,7 +260,15 @@ def main(argv=None):
|
||||
help="Change parameters in templates to match resource names. This was "
|
||||
" the default at one time but it causes issues when parameter "
|
||||
" names need to remain stable.")
|
||||
parser.add_argument(
|
||||
'--hot', action='store_true', default=False,
|
||||
help="Assume source templates are in the HOT format, and generate a "
|
||||
"HOT template artifact.")
|
||||
args = parser.parse_args(argv)
|
||||
if args.hot:
|
||||
global lang
|
||||
lang = Hot()
|
||||
|
||||
templates = args.templates
|
||||
scaling = parse_scaling(args.scale)
|
||||
merged_template = merge(templates, args.master_role, args.slave_roles,
|
||||
|
Loading…
Reference in New Issue
Block a user