Merge "Add LbImageId magic param to aws loadbalancer nested template"
This commit is contained in:
commit
72f8bc4abc
@ -35,6 +35,10 @@ lb_template_default = r'''
|
||||
"KeyName" : {
|
||||
"Type" : "String"
|
||||
},
|
||||
"LbImageId" : {
|
||||
"Type" : "String",
|
||||
"Default" : "Fedora-Cloud-Base-20141203-21.x86_64"
|
||||
},
|
||||
"LbFlavor" : {
|
||||
"Type" : "String",
|
||||
"Default" : "m1.small"
|
||||
@ -169,7 +173,7 @@ lb_template_default = r'''
|
||||
}
|
||||
},
|
||||
"Properties": {
|
||||
"ImageId": "Fedora-Cloud-Base-20141203-21.x86_64",
|
||||
"ImageId": { "Ref": "LbImageId" },
|
||||
"InstanceType": { "Ref": "LbFlavor" },
|
||||
"KeyName": { "Ref": "KeyName" },
|
||||
"SecurityGroups": { "Ref": "SecurityGroups" },
|
||||
@ -536,7 +540,7 @@ backend servers
|
||||
params['SecurityGroups'] = self.properties[self.SECURITY_GROUPS]
|
||||
# If the owning stack defines KeyName, we use that key for the nested
|
||||
# template, otherwise use no key
|
||||
for magic_param in ('KeyName', 'LbFlavor', 'LBTimeout'):
|
||||
for magic_param in ('KeyName', 'LbFlavor', 'LBTimeout', 'LbImageId'):
|
||||
if magic_param in self.stack.parameters:
|
||||
params[magic_param] = self.stack.parameters[magic_param]
|
||||
|
||||
|
@ -40,6 +40,11 @@ lb_template = '''
|
||||
"Description" : "Flavor to use for LoadBalancer instance",
|
||||
"Type": "String",
|
||||
"Default": "m1.heat"
|
||||
},
|
||||
"LbImageId" : {
|
||||
"Description" : "Image to use",
|
||||
"Type" : "String",
|
||||
"Default" : "image123"
|
||||
}
|
||||
},
|
||||
"Resources": {
|
||||
@ -157,6 +162,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
||||
if not include_magic:
|
||||
del template['Parameters']['KeyName']
|
||||
del template['Parameters']['LbFlavor']
|
||||
del template['Parameters']['LbImageId']
|
||||
self.stack = utils.parse_stack(template)
|
||||
|
||||
resource_name = 'LoadBalancer'
|
||||
@ -225,6 +231,16 @@ class LoadBalancerTest(common.HeatTestCase):
|
||||
params = rsrc.child_params()
|
||||
self.assertNotIn('LbFlavor', params)
|
||||
|
||||
def test_child_params_with_image_id(self):
|
||||
rsrc = self.setup_loadbalancer()
|
||||
params = rsrc.child_params()
|
||||
self.assertEqual('image123', params['LbImageId'])
|
||||
|
||||
def test_child_params_without_image_id(self):
|
||||
rsrc = self.setup_loadbalancer(False)
|
||||
params = rsrc.child_params()
|
||||
self.assertNotIn('LbImageId', params)
|
||||
|
||||
def test_child_params_with_sec_gr(self):
|
||||
rsrc = self.setup_loadbalancer(False)
|
||||
params = rsrc.child_params()
|
||||
@ -237,6 +253,7 @@ class LoadBalancerTest(common.HeatTestCase):
|
||||
del template['Parameters']['LbFlavor']
|
||||
del template['Resources']['LoadBalancer']['Properties'][
|
||||
'SecurityGroups']
|
||||
del template['Parameters']['LbImageId']
|
||||
stack = utils.parse_stack(template)
|
||||
|
||||
resource_name = 'LoadBalancer'
|
||||
|
Loading…
x
Reference in New Issue
Block a user