Fix default template for AWS::CloudWatch::Alarm with Ceilometer
Existing template assumes certain parameters to be delimited strings rather than lists and uses 'Fn::Split' to convert them to list. However, delimitedstring representations of parameters are by default converted to list for CommaDelimitedList types. Also includes change for CommaDelimitedList to accept empty string. Change-Id: Ib566f1d098c575a80c4f1a975eaaaac93d70af34 Closes-Bug: #1316842
This commit is contained in:
parent
61bd5f30f2
commit
ce62bdc192
@ -73,14 +73,14 @@ Resources:
|
|||||||
threshold:
|
threshold:
|
||||||
Ref: Threshold
|
Ref: Threshold
|
||||||
alarm_actions:
|
alarm_actions:
|
||||||
"Fn::Split": [",", {Ref: AlarmActions}]
|
Ref: AlarmActions
|
||||||
ok_actions:
|
ok_actions:
|
||||||
"Fn::Split": [",", {Ref: OKActions}]
|
Ref: OKActions
|
||||||
insufficient_data_actions:
|
insufficient_data_actions:
|
||||||
"Fn::Split": [",", {Ref: InsufficientDataActions}]
|
Ref: InsufficientDataActions
|
||||||
statistic:
|
statistic:
|
||||||
"Fn::FindInMap": [StatisticMap, {Ref: Statistic}, Ceilometer]
|
"Fn::FindInMap": [StatisticMap, {Ref: Statistic}, Ceilometer]
|
||||||
comparison_operator:
|
comparison_operator:
|
||||||
"Fn::FindInMap": [ComparisonOperatorMap, {Ref: ComparisonOperator}, Ceilometer]
|
"Fn::FindInMap": [ComparisonOperatorMap, {Ref: ComparisonOperator}, Ceilometer]
|
||||||
matching_metadata:
|
matching_metadata:
|
||||||
"Fn::MemberListToMap": [Name, Value, {"Fn::Split": [",", {Ref: Dimensions}]}]
|
"Fn::MemberListToMap": [Name, Value, {Ref: Dimensions}]
|
||||||
|
@ -316,9 +316,8 @@ class CommaDelimitedListParam(Parameter, collections.Sequence):
|
|||||||
# only parse when value is not already a list
|
# only parse when value is not already a list
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
return value
|
return value
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if value:
|
if value is not None:
|
||||||
return value.split(',')
|
return value.split(',')
|
||||||
except (KeyError, AttributeError) as err:
|
except (KeyError, AttributeError) as err:
|
||||||
message = _('Value must be a comma-delimited list string: %s')
|
message = _('Value must be a comma-delimited list string: %s')
|
||||||
|
@ -224,6 +224,12 @@ class ParameterTest(testtools.TestCase):
|
|||||||
self.new_parameter, 'p', schema, '2')
|
self.new_parameter, 'p', schema, '2')
|
||||||
self.assertIn('wibble', str(err))
|
self.assertIn('wibble', str(err))
|
||||||
|
|
||||||
|
def test_list_value_list_default_empty(self):
|
||||||
|
schema = {'Type': 'CommaDelimitedList'}
|
||||||
|
schema['Default'] = ''
|
||||||
|
p = self.new_parameter('p', schema)
|
||||||
|
self.assertEqual([''], p.value())
|
||||||
|
|
||||||
def test_list_value_list_good(self):
|
def test_list_value_list_good(self):
|
||||||
schema = {'Type': 'CommaDelimitedList',
|
schema = {'Type': 'CommaDelimitedList',
|
||||||
'AllowedValues': ['foo', 'bar', 'baz']}
|
'AllowedValues': ['foo', 'bar', 'baz']}
|
||||||
|
Loading…
Reference in New Issue
Block a user