Add resolve_outputs parameter to stack get method
Also add --no-resolve-outputs parameter to heat stack-show command to let user get stack without outputs. @APIImpact, @DOCImpact Depends-On: I03104efc535a7bd4326cbec56c01cd887db38ab6 Change-Id: I6c715fe90e42259e744b76924673194d0a81c07e
This commit is contained in:
@@ -784,6 +784,46 @@ class ShellTestUserPass(ShellBase):
|
|||||||
for r in required:
|
for r in required:
|
||||||
self.assertRegexpMatches(list_text, r)
|
self.assertRegexpMatches(list_text, r)
|
||||||
|
|
||||||
|
def test_stack_show_without_outputs(self):
|
||||||
|
self.register_keystone_auth_fixture()
|
||||||
|
resp_dict = {"stack": {
|
||||||
|
"id": "1",
|
||||||
|
"stack_name": "teststack",
|
||||||
|
"stack_status": 'CREATE_COMPLETE',
|
||||||
|
"creation_time": "2012-10-25T01:58:47Z"
|
||||||
|
}}
|
||||||
|
resp = fakes.FakeHTTPResponse(
|
||||||
|
200,
|
||||||
|
'OK',
|
||||||
|
{'content-type': 'application/json'},
|
||||||
|
jsonutils.dumps(resp_dict))
|
||||||
|
params = {'resolve_outputs': False}
|
||||||
|
if self.client == http.SessionClient:
|
||||||
|
self.client.request(
|
||||||
|
'/stacks/teststack/1',
|
||||||
|
'GET', params=params).AndReturn(resp)
|
||||||
|
else:
|
||||||
|
self.client.json_request(
|
||||||
|
'GET', '/stacks/teststack/1', params=params
|
||||||
|
).AndReturn((resp, resp_dict))
|
||||||
|
|
||||||
|
self.m.ReplayAll()
|
||||||
|
|
||||||
|
list_text = self.shell(
|
||||||
|
'stack-show teststack/1 --no-resolve-outputs')
|
||||||
|
|
||||||
|
required = [
|
||||||
|
'id',
|
||||||
|
'stack_name',
|
||||||
|
'stack_status',
|
||||||
|
'creation_time',
|
||||||
|
'teststack',
|
||||||
|
'CREATE_COMPLETE',
|
||||||
|
'2012-10-25T01:58:47Z'
|
||||||
|
]
|
||||||
|
for r in required:
|
||||||
|
self.assertRegexpMatches(list_text, r)
|
||||||
|
|
||||||
def _output_fake_response(self, output_key):
|
def _output_fake_response(self, output_key):
|
||||||
|
|
||||||
outputs = [
|
outputs = [
|
||||||
|
@@ -387,9 +387,12 @@ def do_action_check(hc, args):
|
|||||||
|
|
||||||
@utils.arg('id', metavar='<NAME or ID>',
|
@utils.arg('id', metavar='<NAME or ID>',
|
||||||
help=_('Name or ID of stack to describe.'))
|
help=_('Name or ID of stack to describe.'))
|
||||||
|
@utils.arg('--no-resolve-outputs', action="store_true",
|
||||||
|
help='Do not resolve outputs of the stack.')
|
||||||
def do_stack_show(hc, args):
|
def do_stack_show(hc, args):
|
||||||
'''Describe the stack.'''
|
'''Describe the stack.'''
|
||||||
fields = {'stack_id': args.id}
|
fields = {'stack_id': args.id,
|
||||||
|
'resolve_outputs': not args.no_resolve_outputs}
|
||||||
_do_stack_show(hc, fields)
|
_do_stack_show(hc, fields)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -252,12 +252,17 @@ class StackManager(StackChildManager):
|
|||||||
body = utils.get_response_body(resp)
|
body = utils.get_response_body(resp)
|
||||||
return body
|
return body
|
||||||
|
|
||||||
def get(self, stack_id):
|
def get(self, stack_id, resolve_outputs=True):
|
||||||
"""Get the metadata for a specific stack.
|
"""Get the metadata for a specific stack.
|
||||||
|
|
||||||
:param stack_id: Stack ID to lookup
|
:param stack_id: Stack ID to lookup
|
||||||
|
:param resolve_outputs: If True, then outputs for this
|
||||||
|
stack will be resolved
|
||||||
"""
|
"""
|
||||||
resp = self.client.get('/stacks/%s' % stack_id)
|
kwargs = {}
|
||||||
|
if not resolve_outputs:
|
||||||
|
kwargs['params'] = {"resolve_outputs": False}
|
||||||
|
resp = self.client.get('/stacks/%s' % stack_id, **kwargs)
|
||||||
body = utils.get_response_body(resp)
|
body = utils.get_response_body(resp)
|
||||||
return Stack(self, body.get('stack'))
|
return Stack(self, body.get('stack'))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user