Add tag support to create_stack
Ported from python-openstacksdk [1]. When creating a heat stack, this commit adds tag support, as specified by [2] [1] https://review.openstack.org/#/c/525174/ [2] https://developer.openstack.org/api-ref/orchestration/v1/#create-stack Change-Id: Id8495e9ca09f592aad83338b72878a3c40f8e27f
This commit is contained in:
parent
b3d47a032a
commit
e3b301de27
@ -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
|
@ -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,
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user