From 54caa859660f248d3d11f0c5b06f0cf36eacd0ee Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Tue, 14 Jun 2016 15:53:45 +1200 Subject: [PATCH] Set nested_depth when creating Stack from db Without this, deeply nested stacks will all be given the nested_depth value of 1 instead of the actual nested_depth when convergence is enabled. This also means that max_nested_stack_depth currently isn't enforced for convergence created stacks. Change-Id: I34e90ae67e6ec2e235be6cc4a247673eaa7773cf Closes-Bug: #1592243 --- heat/engine/stack.py | 3 ++- heat/tests/test_stack.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/heat/engine/stack.py b/heat/engine/stack.py index 18422a182..e0c7cee5c 100644 --- a/heat/engine/stack.py +++ b/heat/engine/stack.py @@ -528,7 +528,8 @@ class Stack(collections.Mapping): username=stack.username, convergence=stack.convergence, current_traversal=stack.current_traversal, prev_raw_template_id=stack.prev_raw_template_id, - current_deps=stack.current_deps, cache_data=cache_data) + current_deps=stack.current_deps, cache_data=cache_data, + nested_depth=stack.nested_depth) def get_kwargs_for_cloning(self, keep_status=False, only_db=False): """Get common kwargs for calling Stack() for cloning. diff --git a/heat/tests/test_stack.py b/heat/tests/test_stack.py index 415a8483d..66201fb21 100644 --- a/heat/tests/test_stack.py +++ b/heat/tests/test_stack.py @@ -386,7 +386,8 @@ class StackTest(common.HeatTestCase): convergence=False, current_traversal=self.stack.current_traversal, prev_raw_template_id=None, - current_deps=None, cache_data=None) + current_deps=None, cache_data=None, + nested_depth=0) self.m.ReplayAll() stack.Stack.load(self.ctx, stack_id=self.stack.id)