Add Dimensions Default in AWS_CloudWatch_Alarm.yaml

Relying on [1], property Dimensions isn't required, but
this template has no Default value for Dimensions
(thereby making it required). This patch fix that omission.
Besides that, parameters have wrong parsing, because if
parameter with type 'CommaDelimitedList' has default
value '', parameter's parsing result would be [u''] instead
of []. this is wrong, so this patch fix it.

[1] http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html

Change-Id: I259249659c8b5dc846432f8e08985b148b30d682
Closes-bug: #1386824
This commit is contained in:
Peter Razumovsky 2014-11-13 18:31:46 +03:00
parent f39600e28b
commit 1343598890
3 changed files with 5 additions and 3 deletions

View File

@ -43,6 +43,7 @@ Parameters:
Default: ''
Dimensions:
Type: CommaDelimitedList
Default: ''
Mappings:
ComparisonOperatorMap:

View File

@ -335,6 +335,8 @@ class CommaDelimitedListParam(Parameter, collections.Sequence):
return value
try:
if value is not None:
if value == '':
return []
return value.split(',')
except (KeyError, AttributeError) as err:
message = _('Value must be a comma-delimited list string: %s')

View File

@ -251,10 +251,9 @@ class ParameterTest(testtools.TestCase):
self.assertIn('wibble', six.text_type(err))
def test_list_value_list_default_empty(self):
schema = {'Type': 'CommaDelimitedList'}
schema['Default'] = ''
schema = {'Type': 'CommaDelimitedList', 'Default': ''}
p = self.new_parameter('p', schema)
self.assertEqual([''], p.value())
self.assertEqual([], p.value())
def test_list_value_list_good(self):
schema = {'Type': 'CommaDelimitedList',