Support passing a Template object to StackResource
The create_with_template() and update_with_template() methods of the StackResource class previously took raw template data as an argument; this change allows them to accept Template objects also. Change-Id: I7af5d516d4d0c4085144ed53c962cfc6ca3c69bb
This commit is contained in:
parent
54f1bee042
commit
599dd3869e
@ -151,7 +151,12 @@ class StackResource(resource.Resource):
|
||||
msg = _("Recursion depth exceeds %d.") % \
|
||||
cfg.CONF.max_nested_stack_depth
|
||||
raise exception.RequestLimitExceeded(message=msg)
|
||||
template = parser.Template(child_template, files=self.stack.t.files)
|
||||
if isinstance(child_template, parser.Template):
|
||||
template = child_template
|
||||
template.files = self.stack.t.files
|
||||
else:
|
||||
template = parser.Template(child_template,
|
||||
files=self.stack.t.files)
|
||||
self._validate_nested_resources(template)
|
||||
self._outputs_to_attribs(template)
|
||||
|
||||
@ -195,7 +200,12 @@ class StackResource(resource.Resource):
|
||||
def update_with_template(self, child_template, user_params,
|
||||
timeout_mins=None):
|
||||
"""Update the nested stack with the new template."""
|
||||
template = parser.Template(child_template, files=self.stack.t.files)
|
||||
if isinstance(child_template, parser.Template):
|
||||
template = child_template
|
||||
template.files = self.stack.t.files
|
||||
else:
|
||||
template = parser.Template(child_template,
|
||||
files=self.stack.t.files)
|
||||
nested_stack = self.nested()
|
||||
if nested_stack is None:
|
||||
raise exception.Error(_('Cannot update %s, stack not created')
|
||||
|
@ -492,9 +492,6 @@ class StackResourceTest(HeatTestCase):
|
||||
disable_rollback=True,
|
||||
parent_resource=self.parent_resource)
|
||||
|
||||
self.m.StubOutWithMock(parser, 'Template')
|
||||
parser.Template(self.templ, files={}).AndReturn(templ)
|
||||
|
||||
self.m.StubOutWithMock(environment, 'Environment')
|
||||
environment.Environment().AndReturn(env)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user