summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Hardy <shardy@redhat.com>2013-01-04 17:21:53 +0000
committerSteven Hardy <shardy@redhat.com>2013-01-04 17:53:01 +0000
commitc357666d74528a19e767b4f3cc6e48e6328c5c2c (patch)
tree104508631fd7b264cf6bcf057ca066660b611668
parenta5a6ad5a54b6a4d05146051750b193df12da7cdb (diff)
downloadheat-c357666d74528a19e767b4f3cc6e48e6328c5c2c.tar.gz
heat engine : map DBInstance DBSecurityGroups parameter correctly
The DBInstance nested stack template defines a DBSecurityGroups list parameter, which should be "CommaDelimitedList" type, curently it's a "List" type which breaks when the template is parsed. To make this work we also have to mangle the property (passed in the top level template) format to match the parameter format, because in AWS Lists are not represented in the same way for Properties and Parameters (sigh..) fixes bug 1096099 Change-Id: Ie078d61847d89ea9dcd55f798b808e595c2d2e12 Signed-off-by: Steven Hardy <shardy@redhat.com>
-rw-r--r--heat/engine/resources/dbinstance.py11
-rw-r--r--heat/tests/test_dbinstance.py2
2 files changed, 10 insertions, 3 deletions
diff --git a/heat/engine/resources/dbinstance.py b/heat/engine/resources/dbinstance.py
index ea6a8633b..568b223ae 100644
--- a/heat/engine/resources/dbinstance.py
+++ b/heat/engine/resources/dbinstance.py
@@ -46,7 +46,8 @@ mysql_template = r'''
},
"DBSecurityGroups" : {
- "Type": "List"
+ "Type": "CommaDelimitedList",
+ "Default": ""
},
"Port" : {
@@ -214,7 +215,13 @@ class DBInstance(stack.Stack):
# Ignore the not implemented ones
for key, value in self.properties_schema.items():
if value.get('Implemented', True) and key != 'Engine':
- params[key] = self.properties[key]
+ # There is a mismatch between the properties "List" format
+ # and the parameters "CommaDelimitedList" format, so we need
+ # to translate lists into the expected comma-delimited form
+ if isinstance(self.properties[key], list):
+ params[key] = ','.join(self.properties[key])
+ else:
+ params[key] = self.properties[key]
p = self.stack.resolve_static_data(params)
return p
diff --git a/heat/tests/test_dbinstance.py b/heat/tests/test_dbinstance.py
index 1cd0cd1d3..498e7df45 100644
--- a/heat/tests/test_dbinstance.py
+++ b/heat/tests/test_dbinstance.py
@@ -83,7 +83,7 @@ class DBInstanceTest(unittest.TestCase):
'AllocatedStorage': u'5',
'DBInstanceClass': u'db.m1.small',
'DBName': u'wordpress',
- 'DBSecurityGroups': [],
+ 'DBSecurityGroups': '',
'KeyName': 'test',
'MasterUserPassword': u'admin',
'MasterUsername': u'admin',