Merge "Return empty string when Fn::Select target is None."
This commit is contained in:
commit
c77d4d1c15
|
@ -244,6 +244,8 @@ class Template(collections.Mapping):
|
|||
return strings[index]
|
||||
if isinstance(strings, dict) and isinstance(index, basestring):
|
||||
return strings[index]
|
||||
if strings is None:
|
||||
return ''
|
||||
|
||||
raise TypeError('Arguments to "Fn::Select" not fully resolved')
|
||||
|
||||
|
|
|
@ -226,6 +226,10 @@ class TemplateTest(HeatTestCase):
|
|||
data = {"Fn::Select": ["red", {"red": "robin", "re": "foo"}]}
|
||||
self.assertEqual(parser.Template.resolve_select(data), "robin")
|
||||
|
||||
def test_select_from_none(self):
|
||||
data = {"Fn::Select": ["red", None]}
|
||||
self.assertEqual(parser.Template.resolve_select(data), "")
|
||||
|
||||
def test_select_from_dict_not_str(self):
|
||||
data = {"Fn::Select": ["1", {"red": "robin", "re": "foo"}]}
|
||||
self.assertRaises(TypeError, parser.Template.resolve_select,
|
||||
|
|
Loading…
Reference in New Issue