diff --git a/heat/engine/service.py b/heat/engine/service.py index 430c29c9c..d91423ad2 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -306,7 +306,7 @@ class EngineService(service.Service): return webob.exc.HTTPBadRequest(explanation=msg) tmpl = parser.Template(template) - tmpl_resources = template.get('Resources', []) + tmpl_resources = tmpl.get('Resources', []) if not tmpl_resources: return {'Error': 'At least one Resources member must be defined.'} @@ -330,7 +330,7 @@ class EngineService(service.Service): params = tmpl_params.map(format_validate_parameter, is_real_param) result = { - 'Description': template.get('Description', ''), + 'Description': tmpl.get('Description', ''), 'Parameters': params, } return result diff --git a/heat/tests/test_validate.py b/heat/tests/test_validate.py index 20a7211a9..4c971f307 100644 --- a/heat/tests/test_validate.py +++ b/heat/tests/test_validate.py @@ -531,6 +531,23 @@ class validateTest(HeatTestCase): res = dict(engine.validate_template(None, t)) self.assertEqual(res['Description'], 'test.') + def test_validate_hot_valid(self): + t = template_format.parse( + """ + heat_template_version: 2013-05-23 + description: test. + resources: + my_instance: + type: AWS::EC2::Instance + """) + self.m.StubOutWithMock(instances.Instance, 'nova') + instances.Instance.nova().AndReturn(self.fc) + self.m.ReplayAll() + + engine = service.EngineService('a', 't') + res = dict(engine.validate_template(None, t)) + self.assertEqual(res['Description'], 'test.') + def test_validate_ref_invalid(self): t = template_format.parse(test_template_ref % 'WikiDatabasez')