Record the updated_time for nested_stack

Record the updated_time for nested_stack when updating.

Change-Id: Ia22051b05f26d9a1d02fba6c04e40dda3cd572ea
Closes-bug: #1384594
This commit is contained in:
huangtianhua 2014-10-23 17:27:27 +08:00
parent 8354c981ba
commit b3aa1058e0
2 changed files with 8 additions and 1 deletions

View File

@ -229,7 +229,7 @@ class StackResource(resource.Resource):
stack = self._parse_nested_stack(name, child_template, user_params,
timeout_mins)
stack.parameters.set_stack_id(nested_stack.identifier())
nested_stack.updated_time = self.updated_time
updater = scheduler.TaskRunner(nested_stack.update_task, stack)
updater.start()
return updater

View File

@ -11,6 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from datetime import datetime
import six
import uuid
@ -377,6 +378,8 @@ class StackResourceTest(common.HeatTestCase):
new_templ = self.simple_template.copy()
inst_snippet = new_templ["Resources"]["WebServer"].copy()
new_templ["Resources"]["WebServer2"] = inst_snippet
self.parent_resource.updated_time = datetime(2014, 10, 24, 15, 40)
updater = self.parent_resource.update_with_template(
new_templ, {})
updater.run_to_completion()
@ -386,11 +389,15 @@ class StackResourceTest(common.HeatTestCase):
self.assertEqual(set(["WebServer", "WebServer2"]),
set(self.stack.keys()))
self.assertIsNone(self.stack.timeout_mins)
self.assertIsNotNone(self.stack.updated_time)
# The stack's owner_id is maintained.
saved_stack = parser.Stack.load(
self.parent_stack.context, self.stack.id)
self.assertEqual(self.parent_stack.id, saved_stack.owner_id)
# Check the stack's updated_time is saved and same as the resource
self.assertEqual(self.parent_resource.updated_time,
saved_stack.updated_time)
def test_update_with_template_timeout_mins(self):
self.assertIsNone(self.parent_stack.timeout_mins)