Implement update_stack client method.
Change-Id: I392af6cf5e905f552c113024c4c62b85d7bd0d31
diff --git a/tempest/services/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py
index e2d1f2b..22f3f26 100644
--- a/tempest/services/orchestration/json/orchestration_client.py
+++ b/tempest/services/orchestration/json/orchestration_client.py
@@ -46,6 +46,35 @@
def create_stack(self, name, disable_rollback=True, parameters={},
timeout_mins=60, template=None, template_url=None):
+ headers, body = self._prepare_update_create(
+ name,
+ disable_rollback,
+ parameters,
+ timeout_mins,
+ template,
+ template_url)
+ uri = 'stacks'
+ resp, body = self.post(uri, headers=headers, body=body)
+ return resp, body
+
+ def update_stack(self, stack_identifier, name, disable_rollback=True,
+ parameters={}, timeout_mins=60, template=None,
+ template_url=None):
+ headers, body = self._prepare_update_create(
+ name,
+ disable_rollback,
+ parameters,
+ timeout_mins,
+ template,
+ template_url)
+
+ uri = "stacks/%s" % stack_identifier
+ resp, body = self.put(uri, headers=headers, body=body)
+ return resp, body
+
+ def _prepare_update_create(self, name, disable_rollback=True,
+ parameters={}, timeout_mins=60,
+ template=None, template_url=None):
post_body = {
"stack_name": name,
"disable_rollback": disable_rollback,
@@ -58,16 +87,13 @@
if template_url:
post_body['template_url'] = template_url
body = json.dumps(post_body)
- uri = 'stacks'
# Password must be provided on stack create so that heat
# can perform future operations on behalf of the user
headers = dict(self.headers)
headers['X-Auth-Key'] = self.password
headers['X-Auth-User'] = self.user
-
- resp, body = self.post(uri, headers=headers, body=body)
- return resp, body
+ return headers, body
def get_stack(self, stack_identifier):
"""Returns the details of a single stack."""