Merge "Add APIs implementation for output functions"
This commit is contained in:
commit
63cebcb0ea
@ -62,6 +62,8 @@
|
||||
"stacks:delete_snapshot": "rule:deny_stack_user",
|
||||
"stacks:list_snapshots": "rule:deny_stack_user",
|
||||
"stacks:restore_snapshot": "rule:deny_stack_user",
|
||||
"stacks:list_outputs": "rule:deny_stack_user",
|
||||
"stacks:show_output": "rule:deny_stack_user",
|
||||
|
||||
"software_configs:global_index": "rule:deny_everybody",
|
||||
"software_configs:index": "rule:deny_stack_user",
|
||||
|
@ -265,6 +265,21 @@ class API(wsgi.Router):
|
||||
'{snapshot_id}/restore',
|
||||
'action': 'restore_snapshot',
|
||||
'method': 'POST'
|
||||
},
|
||||
|
||||
# Stack outputs
|
||||
{
|
||||
'name': 'stack_output_list',
|
||||
'url': '/stacks/{stack_name}/{stack_id}/outputs',
|
||||
'action': 'list_outputs',
|
||||
'method': 'GET'
|
||||
},
|
||||
{
|
||||
'name': 'stack_output_show',
|
||||
'url': '/stacks/{stack_name}/{stack_id}/outputs/'
|
||||
'{output_key}',
|
||||
'action': 'show_output',
|
||||
'method': 'GET'
|
||||
}
|
||||
])
|
||||
|
||||
|
@ -628,6 +628,19 @@ class StackController(object):
|
||||
self.rpc_client.stack_restore(req.context, identity, snapshot_id)
|
||||
raise exc.HTTPAccepted()
|
||||
|
||||
@util.identified_stack
|
||||
def list_outputs(self, req, identity):
|
||||
return {
|
||||
'outputs': self.rpc_client.list_outputs(
|
||||
req.context, identity)
|
||||
}
|
||||
|
||||
@util.identified_stack
|
||||
def show_output(self, req, identity, output_key):
|
||||
return {'output': self.rpc_client.show_output(req.context,
|
||||
identity,
|
||||
output_key)}
|
||||
|
||||
|
||||
class StackSerializer(serializers.JSONResponseSerializer):
|
||||
"""Handles serialization of specific controller method responses."""
|
||||
|
@ -291,7 +291,7 @@ class EngineService(service.Service):
|
||||
by the RPC caller.
|
||||
"""
|
||||
|
||||
RPC_API_VERSION = '1.18'
|
||||
RPC_API_VERSION = '1.19'
|
||||
|
||||
def __init__(self, host, topic):
|
||||
super(EngineService, self).__init__()
|
||||
|
@ -37,6 +37,7 @@ class EngineClient(object):
|
||||
1.16 - Adds version, type_name to list_resource_types()
|
||||
1.17 - Add files to validate_template
|
||||
1.18 - Add show_nested to validate_template
|
||||
1.19 - Add show_output and list_outputs for returning stack outputs
|
||||
"""
|
||||
|
||||
BASE_RPC_API_VERSION = '1.0'
|
||||
@ -686,3 +687,14 @@ class EngineClient(object):
|
||||
|
||||
def list_services(self, cnxt):
|
||||
return self.call(cnxt, self.make_msg('list_services'), version='1.4')
|
||||
|
||||
def list_outputs(self, cntx, stack_identity):
|
||||
return self.call(cntx, self.make_msg('list_outputs',
|
||||
stack_identity=stack_identity),
|
||||
version='1.19')
|
||||
|
||||
def show_output(self, cntx, stack_identity, output_key):
|
||||
return self.call(cntx, self.make_msg('show_output',
|
||||
stack_identity=stack_identity,
|
||||
output_key=output_key),
|
||||
version='1.19')
|
||||
|
@ -235,6 +235,34 @@ class RoutesTest(common.HeatTestCase):
|
||||
'snapshot_id': 'cccc'
|
||||
})
|
||||
|
||||
def test_stack_outputs(self):
|
||||
self.assertRoute(
|
||||
self.m,
|
||||
'/aaaa/stacks/teststack/bbbb/outputs',
|
||||
'GET',
|
||||
'list_outputs',
|
||||
'StackController',
|
||||
{
|
||||
'tenant_id': 'aaaa',
|
||||
'stack_name': 'teststack',
|
||||
'stack_id': 'bbbb'
|
||||
}
|
||||
)
|
||||
|
||||
self.assertRoute(
|
||||
self.m,
|
||||
'/aaaa/stacks/teststack/bbbb/outputs/cccc',
|
||||
'GET',
|
||||
'show_output',
|
||||
'StackController',
|
||||
{
|
||||
'tenant_id': 'aaaa',
|
||||
'stack_name': 'teststack',
|
||||
'stack_id': 'bbbb',
|
||||
'output_key': 'cccc'
|
||||
}
|
||||
)
|
||||
|
||||
def test_stack_data_template(self):
|
||||
self.assertRoute(
|
||||
self.m,
|
||||
|
@ -40,7 +40,7 @@ class ServiceEngineTest(common.HeatTestCase):
|
||||
|
||||
def test_make_sure_rpc_version(self):
|
||||
self.assertEqual(
|
||||
'1.18',
|
||||
'1.19',
|
||||
service.EngineService.RPC_API_VERSION,
|
||||
('RPC version is changed, please update this test to new version '
|
||||
'and make sure additional test cases are added for RPC APIs '
|
||||
|
@ -364,3 +364,14 @@ class EngineRpcAPITestCase(common.HeatTestCase):
|
||||
|
||||
def test_list_services(self):
|
||||
self._test_engine_api('list_services', 'call', version='1.4')
|
||||
|
||||
def test_stack_list_outputs(self):
|
||||
self._test_engine_api(
|
||||
'list_outputs', 'call', stack_identity=self.identity,
|
||||
version='1.19'
|
||||
)
|
||||
|
||||
def test_stack_show_output(self):
|
||||
self._test_engine_api(
|
||||
'show_output', 'call', stack_identity=self.identity,
|
||||
output_key='test', version='1.19')
|
||||
|
Loading…
Reference in New Issue
Block a user