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
This commit is contained in:
Jiri Stransky 2016-04-07 13:50:27 +02:00
parent e7441531db
commit 03eb4b44af
2 changed files with 2 additions and 2 deletions

View File

@ -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': {

View File

@ -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))