API tolerate None environment string
If an API request has a None environment argument, we should not reject the request, but treat it the same as an empty environment. Change-Id: I812f308ef38833e89dfa2ce01263a297032f563a Closes-Bug: #1273993
This commit is contained in:
parent
3d2517b2c7
commit
7530b16513
@ -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:
|
||||
|
@ -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):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user