summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-09-25 09:47:06 +0000
committerGerrit Code Review <review@openstack.org>2014-09-25 09:47:06 +0000
commit6089d31e302d80910cc15132f99a1bf358bbb64f (patch)
tree752217978ac41ebe3e7a0cf38708e324ac634c09
parent346e1634000e8c55e6ec85d0cdcc21126f6d81ad (diff)
parentd767878219c2ee0496f6394a8e08b2ffed01f58f (diff)
downloadpython-heatclient-6089d31e302d80910cc15132f99a1bf358bbb64f.tar.gz
Merge "Client supports check action"0.2.12
-rw-r--r--heatclient/tests/test_shell.py28
-rw-r--r--heatclient/tests/test_stacks.py3
-rw-r--r--heatclient/v1/actions.py7
-rw-r--r--heatclient/v1/shell.py13
4 files changed, 50 insertions, 1 deletions
diff --git a/heatclient/tests/test_shell.py b/heatclient/tests/test_shell.py
index 701bb65..3a4ac10 100644
--- a/heatclient/tests/test_shell.py
+++ b/heatclient/tests/test_shell.py
@@ -1623,6 +1623,34 @@ class ShellTestUserPass(ShellBase):
self.assertRegexpMatches(update_text, r)
@httpretty.activate
+ def test_stack_check(self):
+ self.register_keystone_auth_fixture()
+ expected_data = {'check': None}
+ resp = fakes.FakeHTTPResponse(
+ 202,
+ 'Accepted',
+ {},
+ 'The request is accepted for processing.')
+ http.HTTPClient.json_request(
+ 'POST', '/stacks/teststack2/actions',
+ data=expected_data
+ ).AndReturn((resp, None))
+ fakes.script_heat_list()
+
+ self.m.ReplayAll()
+
+ check_text = self.shell('action-check teststack2')
+
+ required = [
+ 'stack_name',
+ 'id',
+ 'teststack2',
+ '1'
+ ]
+ for r in required:
+ self.assertRegexpMatches(check_text, r)
+
+ @httpretty.activate
def test_stack_delete(self):
self.register_keystone_auth_fixture()
resp = fakes.FakeHTTPResponse(
diff --git a/heatclient/tests/test_stacks.py b/heatclient/tests/test_stacks.py
index 4886342..e5042c2 100644
--- a/heatclient/tests/test_stacks.py
+++ b/heatclient/tests/test_stacks.py
@@ -44,7 +44,8 @@ class StackStatusActionTest(testtools.TestCase):
('UPDATE', dict(action='UPDATE')),
('ROLLBACK', dict(action='ROLLBACK')),
('SUSPEND', dict(action='SUSPEND')),
- ('RESUME', dict(action='RESUME'))
+ ('RESUME', dict(action='RESUME')),
+ ('CHECK', dict(action='CHECK'))
], [
('IN_PROGRESS', dict(status='IN_PROGRESS')),
('FAILED', dict(status='FAILED')),
diff --git a/heatclient/v1/actions.py b/heatclient/v1/actions.py
index 9c7028f..4ecd2b6 100644
--- a/heatclient/v1/actions.py
+++ b/heatclient/v1/actions.py
@@ -53,3 +53,10 @@ class ActionManager(stacks.StackChildManager):
resp, body = self.client.json_request('POST',
'/stacks/%s/actions' % stack_id,
data=body)
+
+ def check(self, stack_id):
+ """Check a stack."""
+ body = {'check': None}
+ resp, body = self.client.json_request('POST',
+ '/stacks/%s/actions' % stack_id,
+ data=body)
diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py
index 3032956..fa73cd6 100644
--- a/heatclient/v1/shell.py
+++ b/heatclient/v1/shell.py
@@ -307,6 +307,19 @@ def do_action_resume(hc, args):
@utils.arg('id', metavar='<NAME or ID>',
+ help='Name or ID of stack to check.')
+def do_action_check(hc, args):
+ '''Check that stack resources are in expected states.'''
+ fields = {'stack_id': args.id}
+ try:
+ hc.actions.check(**fields)
+ except exc.HTTPNotFound:
+ raise exc.CommandError('Stack not found: %s' % args.id)
+ else:
+ do_stack_list(hc)
+
+
+@utils.arg('id', metavar='<NAME or ID>',
help='Name or ID of stack to describe.')
def do_describe(hc, args):
'''DEPRECATED! Use stack-show instead.'''