From a0ec8ef7fdc7b0860f2922340655b5b730cd3123 Mon Sep 17 00:00:00 2001 From: Bharat Kunwar Date: Thu, 14 Mar 2019 00:16:30 +0000 Subject: [PATCH] Do not disregard tags when updating stacks At present, if tags are supplied to the update_stack function, it is completely disregarded while create_stack in fact allows it. This leads the Ansible module os_stack to also not be able to propagate tags properly. This is suboptimal therefore this patch aims to sort the issue out. Resolves: https://github.com/ansible/ansible/pull/53757 Change-Id: I59e7c47b8c01f96ec561b8bd153804bac5f21800 Story: 2005226 Task: 30008 --- openstack/cloud/_orchestration.py | 3 ++- openstack/tests/unit/cloud/test_stack.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/openstack/cloud/_orchestration.py b/openstack/cloud/_orchestration.py index bb3343ad6..95b01320b 100644 --- a/openstack/cloud/_orchestration.py +++ b/openstack/cloud/_orchestration.py @@ -110,7 +110,7 @@ class OrchestrationCloudMixin(_normalize.Normalizer): self, name_or_id, template_file=None, template_url=None, template_object=None, files=None, - rollback=True, + rollback=True, tags=None, wait=False, timeout=3600, environment_files=None, **parameters): @@ -146,6 +146,7 @@ class OrchestrationCloudMixin(_normalize.Normalizer): files=files) params = dict( disable_rollback=not rollback, + tags=tags, parameters=parameters, template=template, files=dict(list(tpl_files.items()) + list(envfiles.items())), diff --git a/openstack/tests/unit/cloud/test_stack.py b/openstack/tests/unit/cloud/test_stack.py index 08c856daa..20ce23773 100644 --- a/openstack/tests/unit/cloud/test_stack.py +++ b/openstack/tests/unit/cloud/test_stack.py @@ -425,6 +425,7 @@ class TestStack(base.TestCase): 'environment': {}, 'files': {}, 'parameters': {}, + 'tags': self.stack_tag, 'template': fakes.FAKE_TEMPLATE_CONTENT, 'timeout_mins': 60})), dict( @@ -446,6 +447,7 @@ class TestStack(base.TestCase): ]) self.cloud.update_stack( self.stack_name, + tags=self.stack_tag, template_file=test_template.name) self.assert_calls() @@ -479,6 +481,7 @@ class TestStack(base.TestCase): 'environment': {}, 'files': {}, 'parameters': {}, + 'tags': self.stack_tag, 'template': fakes.FAKE_TEMPLATE_CONTENT, 'timeout_mins': 60})), dict( @@ -512,6 +515,7 @@ class TestStack(base.TestCase): ]) self.cloud.update_stack( self.stack_name, + tags=self.stack_tag, template_file=test_template.name, wait=True)