Add client library support for retrieving a stack's environment
Change-Id: I84aa5ed9dc2b8aee089de3b1e1810552b8f2dd96 Depends-On: I7e3577dfc854018245d79afdfee45a9d250d73a7 Implements: blueprint environment-show
This commit is contained in:
parent
726415e43c
commit
3f340cd818
|
@ -150,6 +150,12 @@ class StackOperationsTest(testtools.TestCase):
|
||||||
manager.output_show.assert_called_once_with('the_stack/abcd1234',
|
manager.output_show.assert_called_once_with('the_stack/abcd1234',
|
||||||
'out123')
|
'out123')
|
||||||
|
|
||||||
|
def test_environment_show(self):
|
||||||
|
manager = mock.MagicMock()
|
||||||
|
stack = mock_stack(manager, 'env_stack', 'env1')
|
||||||
|
stack.environment()
|
||||||
|
manager.environment.assert_called_once_with('env_stack/env1')
|
||||||
|
|
||||||
|
|
||||||
class StackManagerNoPaginationTest(testtools.TestCase):
|
class StackManagerNoPaginationTest(testtools.TestCase):
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,9 @@ class Stack(base.Resource):
|
||||||
def output_show(self, output_key):
|
def output_show(self, output_key):
|
||||||
return self.manager.output_show(self.identifier, output_key)
|
return self.manager.output_show(self.identifier, output_key)
|
||||||
|
|
||||||
|
def environment(self):
|
||||||
|
return self.manager.environment(self.identifier)
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
# set_loaded() first ... so if we have to bail, we know we tried.
|
# set_loaded() first ... so if we have to bail, we know we tried.
|
||||||
self._loaded = True
|
self._loaded = True
|
||||||
|
@ -274,6 +277,16 @@ class StackManager(StackChildManager):
|
||||||
body = utils.get_response_body(resp)
|
body = utils.get_response_body(resp)
|
||||||
return body
|
return body
|
||||||
|
|
||||||
|
def environment(self, stack_id):
|
||||||
|
"""Returns the environment for an existing stack.
|
||||||
|
|
||||||
|
:param stack_id: identifies the stack
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
resp = self.client.get('/stacks/%s/environment' % stack_id)
|
||||||
|
body = utils.get_response_body(resp)
|
||||||
|
return body
|
||||||
|
|
||||||
def validate(self, **kwargs):
|
def validate(self, **kwargs):
|
||||||
"""Validate a stack template."""
|
"""Validate a stack template."""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue