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 fixes 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 fixes it.
[1] http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cw-alarm.html
Change-Id: I259249659c8b5dc846432f8e08985b148b30d682
Closes-bug: #1402015
(cherry picked from commit 1343598890
)
This commit is contained in:
parent
4ee5264d54
commit
aabd3d8fc7
|
@ -43,6 +43,7 @@ Parameters:
|
|||
Default: ''
|
||||
Dimensions:
|
||||
Type: CommaDelimitedList
|
||||
Default: ''
|
||||
|
||||
Mappings:
|
||||
ComparisonOperatorMap:
|
||||
|
|
|
@ -338,6 +338,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')
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue