summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-03-03 19:52:45 +0000
committerGerrit Code Review <review@openstack.org>2020-03-03 19:52:45 +0000
commit9ad5335bc77ddb558a51e2547cfe2b79b33330dd (patch)
tree3cbc39901e0cf7869176dc6eca849bbb8bd3047e
parent0d4139be70823b9e4b6fa224e1d0cc42765a1e98 (diff)
parent2540dfd450d846c268c9117304abac83b149fe4a (diff)
downloadheat-9ad5335bc77ddb558a51e2547cfe2b79b33330dd.tar.gz
Merge "Allow tags to be removed with update --existing"
-rw-r--r--heat/engine/api.py2
-rw-r--r--heat/tests/engine/service/test_stack_update.py10
2 files changed, 11 insertions, 1 deletions
diff --git a/heat/engine/api.py b/heat/engine/api.py
index 4cc6a6d9b..5ad560faa 100644
--- a/heat/engine/api.py
+++ b/heat/engine/api.py
@@ -60,7 +60,7 @@ def extract_args(params):
kwargs[rpc_api.PARAM_ADOPT_STACK_DATA] = adopt_data
tags = params.get(rpc_api.PARAM_TAGS)
- if tags:
+ if tags is not None:
if not isinstance(tags, list):
raise ValueError(_('Invalid tags, not a list: %s') % tags)
diff --git a/heat/tests/engine/service/test_stack_update.py b/heat/tests/engine/service/test_stack_update.py
index f45adc35c..f340884b9 100644
--- a/heat/tests/engine/service/test_stack_update.py
+++ b/heat/tests/engine/service/test_stack_update.py
@@ -385,11 +385,21 @@ resources:
self.ctx, stk, t, {}, None, None, None, api_args, None)
self.assertEqual(['tag1'], updated_stack.tags)
+ # update clear old tags
+ api_args[rpc_api.STACK_TAGS] = []
+ _, _, updated_stack = self.man._prepare_stack_updates(
+ self.ctx, stk, t, {}, None, None, None, api_args, None)
+ self.assertEqual([], updated_stack.tags)
+
# with new tags
api_args[rpc_api.STACK_TAGS] = ['tag2']
_, _, updated_stack = self.man._prepare_stack_updates(
self.ctx, stk, t, {}, None, None, None, api_args, None)
self.assertEqual(['tag2'], updated_stack.tags)
+ api_args[rpc_api.STACK_TAGS] = ['tag3']
+ _, _, updated_stack = self.man._prepare_stack_updates(
+ self.ctx, stk, t, {}, None, None, None, api_args, None)
+ self.assertEqual(['tag3'], updated_stack.tags)
# with no PARAM_EXISTING flag and no tags
del api_args[rpc_api.PARAM_EXISTING]