diff --git a/releasenotes/notes/add_heat_tag_support-0668933506135082.yaml b/releasenotes/notes/add_heat_tag_support-0668933506135082.yaml new file mode 100644 index 000000000..4e0a0ea87 --- /dev/null +++ b/releasenotes/notes/add_heat_tag_support-0668933506135082.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Add tags support when creating a stack, as specified by the openstack + orchestration api at [1] + + [1]https://developer.openstack.org/api-ref/orchestration/v1/#create-stack diff --git a/shade/openstackcloud.py b/shade/openstackcloud.py index b59fa834d..278fa1d50 100644 --- a/shade/openstackcloud.py +++ b/shade/openstackcloud.py @@ -1279,7 +1279,7 @@ class OpenStackCloud( "Error in processing template files: %s" % str(e)) def create_stack( - self, name, + self, name, tags=None, template_file=None, template_url=None, template_object=None, files=None, rollback=True, @@ -1289,6 +1289,7 @@ class OpenStackCloud( """Create a stack. :param string name: Name of the stack. + :param tags: List of tag(s) of the stack. (optional) :param string template_file: Path to the template. :param string template_url: URL of template. :param string template_object: URL to retrieve template object. @@ -1318,6 +1319,7 @@ class OpenStackCloud( files=files) params = dict( stack_name=name, + tags=tags, disable_rollback=not rollback, parameters=parameters, template=template, diff --git a/shade/tests/unit/test_stack.py b/shade/tests/unit/test_stack.py index cc83eb2ec..5c4daa635 100644 --- a/shade/tests/unit/test_stack.py +++ b/shade/tests/unit/test_stack.py @@ -26,6 +26,7 @@ class TestStack(base.RequestsMockTestCase): super(TestStack, self).setUp() self.stack_id = self.getUniqueString('id') self.stack_name = self.getUniqueString('name') + self.stack_tag = self.getUniqueString('tag') self.stack = fakes.make_fake_stack(self.stack_id, self.stack_name) def test_list_stacks(self): @@ -304,6 +305,7 @@ class TestStack(base.RequestsMockTestCase): 'files': {}, 'parameters': {}, 'stack_name': self.stack_name, + 'tags': self.stack_tag, 'template': fakes.FAKE_TEMPLATE_CONTENT, 'timeout_mins': 60} )), @@ -327,6 +329,7 @@ class TestStack(base.RequestsMockTestCase): self.cloud.create_stack( self.stack_name, + tags=self.stack_tag, template_file=test_template.name ) @@ -350,6 +353,7 @@ class TestStack(base.RequestsMockTestCase): 'files': {}, 'parameters': {}, 'stack_name': self.stack_name, + 'tags': self.stack_tag, 'template': fakes.FAKE_TEMPLATE_CONTENT, 'timeout_mins': 60} )), @@ -383,6 +387,7 @@ class TestStack(base.RequestsMockTestCase): ]) self.cloud.create_stack( self.stack_name, + tags=self.stack_tag, template_file=test_template.name, wait=True)