From 03eb4b44af7fa30b0edf8ddf58aa330161ea6d54 Mon Sep 17 00:00:00 2001 From: Jiri Stransky Date: Thu, 7 Apr 2016 13:50:27 +0200 Subject: [PATCH] StackAction parameter to distinguish top-level create vs. update Previously we tried to use UpdateIdentifier for two different things: tell whether to perform package update, and also to tell whether the top-level stack is being created or updated (which was incorrect and resulted in bug 1567384, and an attempt to work around that bug resulted in bug 1567385). We cannot use Heat's "action" conditionals in some cases, because they refer to the direct parent stack, which can yield undesirable results when introducing new nested stacks or temporarily no-opping something and then adding it back (in both these cases, "action" would be considered "CREATE", even though the top-level stack is in "UPDATE"). Change-Id: I5e7eb522521d985f374db91e7258e5b474b6b2c9 Related-Bug: #1567384 Related-Bug: #1567385 --- tripleo_common/tests/test_update.py | 2 +- tripleo_common/update.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tripleo_common/tests/test_update.py b/tripleo_common/tests/test_update.py index e004dadca..cde9c81c6 100644 --- a/tripleo_common/tests/test_update.py +++ b/tripleo_common/tests/test_update.py @@ -48,7 +48,7 @@ class UpdateManagerTest(base.TestCase): 'stack_id': 'stack_id', 'template': 'template body', 'files': {}, - 'parameters': {'UpdateIdentifier': 123}, + 'parameters': {'UpdateIdentifier': 123, 'StackAction': 'UPDATE'}, 'environment': { 'resource_registry': { 'resources': { diff --git a/tripleo_common/update.py b/tripleo_common/update.py index 2a617620e..839fe6157 100644 --- a/tripleo_common/update.py +++ b/tripleo_common/update.py @@ -49,7 +49,7 @@ class PackageUpdateManager(_stack_update.StackUpdateManager): # time rounded to seconds timestamp = int(time.time()) - stack_params = {'UpdateIdentifier': timestamp} + stack_params = {'UpdateIdentifier': timestamp, 'StackAction': 'UPDATE'} tpl_files, template = template_utils.get_template_contents( template_file=os.path.join(self.tht_dir, constants.TEMPLATE_NAME))