Merge "API tolerate None environment string"

This commit is contained in:
Jenkins 2014-01-30 15:27:23 +00:00 committed by Gerrit Code Review
commit 0fe67485f9
2 changed files with 6 additions and 2 deletions

View File

@ -24,9 +24,10 @@ SECTIONS = (PARAMETERS, RESOURCE_REGISTRY) = \
def parse(env_str):
'''
Takes a string and returns a dict containing the parsed structure.
This includes determination of whether the string is using the
JSON or YAML format.
'''
if env_str is None:
return {}
try:
env = yaml.load(env_str, Loader=yaml_loader)
except yaml.YAMLError as yea:

View File

@ -45,6 +45,9 @@ parameters: }
'''
self.assertRaises(ValueError, environment_format.parse, env)
def test_yaml_none(self):
self.assertEqual({}, environment_format.parse(None))
class YamlParseExceptions(common.HeatTestCase):