Merge "Don't load nested stack to get TemplateResource template"

This commit is contained in:
Zuul 2018-04-02 22:08:35 +00:00 committed by Gerrit Code Review
commit 9cc118c182
2 changed files with 7 additions and 5 deletions

View File

@ -205,8 +205,11 @@ class TemplateResource(stack_resource.StackResource):
reported_excp = err
if t_data is None:
if self.resource_id is not None:
t_data = jsonutils.dumps(self.nested().t.t)
nested_identifier = self.nested_identifier()
if nested_identifier is not None:
nested_t = self.rpc_client().get_template(self.context,
nested_identifier)
t_data = jsonutils.dumps(nested_t)
if t_data is not None:
if t_data != stored_t_data:

View File

@ -952,13 +952,12 @@ class TemplateDataTest(common.HeatTestCase):
def test_template_data_in_create_without_template_file(self):
self.res.action = self.res.CREATE
self.res.nested = mock.MagicMock()
self.res.resource_id = 'dummy_id'
self.res.resource_id = None
self.res.get_template_file = mock.Mock(
side_effect=exception.NotFound(
msg_fmt='Could not fetch remote template '
'"test_resource.template": file not found'))
self.assertEqual('{}', self.res.template_data())
self.assertRaises(exception.NotFound, self.res.template_data)
class TemplateResourceCrudTest(common.HeatTestCase):