From 8a40be3bf6aaa87a66e8c91400020328fc21177e Mon Sep 17 00:00:00 2001 From: Jason Dunsmore Date: Tue, 30 Dec 2014 16:08:48 -0600 Subject: [PATCH] Add a "show_hidden" parameter to stack-list API Passing "show_hidden=True" will result in hidden stacks being shown in the stack listing. blueprint stack-tags Change-Id: I3074282131443c8e3894f9ce9e363a4438f5a11e --- heat/api/openstack/v1/stacks.py | 11 ++++++++++- heat/rpc/api.py | 4 ++-- heat/tests/test_api_openstack_v1.py | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/heat/api/openstack/v1/stacks.py b/heat/api/openstack/v1/stacks.py index c86f17b13..e29ce0f7a 100644 --- a/heat/api/openstack/v1/stacks.py +++ b/heat/api/openstack/v1/stacks.py @@ -185,6 +185,7 @@ class StackController(object): 'sort_keys': 'multi', 'show_deleted': 'single', 'show_nested': 'single', + 'show_hidden': 'single', } params = util.get_allowed_params(req.params, whitelist) filter_params = util.get_allowed_params(req.params, filter_whitelist) @@ -194,6 +195,7 @@ class StackController(object): params[rpc_api.PARAM_SHOW_DELETED] = param_utils.extract_bool( params[rpc_api.PARAM_SHOW_DELETED]) show_deleted = params[rpc_api.PARAM_SHOW_DELETED] + show_nested = False if rpc_api.PARAM_SHOW_NESTED in params: params[rpc_api.PARAM_SHOW_NESTED] = param_utils.extract_bool( @@ -204,6 +206,12 @@ class StackController(object): if key in params: params[key] = param_utils.extract_int(key, params[key]) + show_hidden = False + if rpc_api.PARAM_SHOW_HIDDEN in params: + params[rpc_api.PARAM_SHOW_HIDDEN] = param_utils.extract_bool( + params[rpc_api.PARAM_SHOW_HIDDEN]) + show_hidden = params[rpc_api.PARAM_SHOW_HIDDEN] + # get the with_count value, if invalid, raise ValueError with_count = False if req.params.get('with_count'): @@ -227,7 +235,8 @@ class StackController(object): filters=filter_params, tenant_safe=tenant_safe, show_deleted=show_deleted, - show_nested=show_nested) + show_nested=show_nested, + show_hidden=show_hidden) except AttributeError as exc: LOG.warn(_LW("Old Engine Version: %s") % exc) diff --git a/heat/rpc/api.py b/heat/rpc/api.py index dbde05906..67e2be144 100644 --- a/heat/rpc/api.py +++ b/heat/rpc/api.py @@ -18,12 +18,12 @@ PARAM_KEYS = ( PARAM_TIMEOUT, PARAM_DISABLE_ROLLBACK, PARAM_ADOPT_STACK_DATA, PARAM_SHOW_DELETED, PARAM_SHOW_NESTED, PARAM_EXISTING, PARAM_CLEAR_PARAMETERS, PARAM_GLOBAL_TENANT, PARAM_LIMIT, - PARAM_NESTED_DEPTH, PARAM_TAGS + PARAM_NESTED_DEPTH, PARAM_TAGS, PARAM_SHOW_HIDDEN ) = ( 'timeout_mins', 'disable_rollback', 'adopt_stack_data', 'show_deleted', 'show_nested', 'existing', 'clear_parameters', 'global_tenant', 'limit', - 'nested_depth', 'tags' + 'nested_depth', 'tags', 'show_hidden' ) STACK_KEYS = ( diff --git a/heat/tests/test_api_openstack_v1.py b/heat/tests/test_api_openstack_v1.py index e5a7d2f74..308517982 100644 --- a/heat/tests/test_api_openstack_v1.py +++ b/heat/tests/test_api_openstack_v1.py @@ -607,7 +607,8 @@ class StackControllerTest(ControllerTest, common.HeatTestCase): filters=mock.ANY, tenant_safe=True, show_deleted=True, - show_nested=False) + show_nested=False, + show_hidden=False) @mock.patch.object(rpc_client.EngineClient, 'call') def test_detail(self, mock_call, mock_enforce):