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
This commit is contained in:
Jason Dunsmore 2014-12-30 16:08:48 -06:00
parent d4361580ba
commit 8a40be3bf6
3 changed files with 14 additions and 4 deletions

View File

@ -185,6 +185,7 @@ class StackController(object):
'sort_keys': 'multi', 'sort_keys': 'multi',
'show_deleted': 'single', 'show_deleted': 'single',
'show_nested': 'single', 'show_nested': 'single',
'show_hidden': 'single',
} }
params = util.get_allowed_params(req.params, whitelist) params = util.get_allowed_params(req.params, whitelist)
filter_params = util.get_allowed_params(req.params, filter_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] = param_utils.extract_bool(
params[rpc_api.PARAM_SHOW_DELETED]) params[rpc_api.PARAM_SHOW_DELETED])
show_deleted = params[rpc_api.PARAM_SHOW_DELETED] show_deleted = params[rpc_api.PARAM_SHOW_DELETED]
show_nested = False show_nested = False
if rpc_api.PARAM_SHOW_NESTED in params: if rpc_api.PARAM_SHOW_NESTED in params:
params[rpc_api.PARAM_SHOW_NESTED] = param_utils.extract_bool( params[rpc_api.PARAM_SHOW_NESTED] = param_utils.extract_bool(
@ -204,6 +206,12 @@ class StackController(object):
if key in params: if key in params:
params[key] = param_utils.extract_int(key, params[key]) 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 # get the with_count value, if invalid, raise ValueError
with_count = False with_count = False
if req.params.get('with_count'): if req.params.get('with_count'):
@ -227,7 +235,8 @@ class StackController(object):
filters=filter_params, filters=filter_params,
tenant_safe=tenant_safe, tenant_safe=tenant_safe,
show_deleted=show_deleted, show_deleted=show_deleted,
show_nested=show_nested) show_nested=show_nested,
show_hidden=show_hidden)
except AttributeError as exc: except AttributeError as exc:
LOG.warn(_LW("Old Engine Version: %s") % exc) LOG.warn(_LW("Old Engine Version: %s") % exc)

View File

@ -18,12 +18,12 @@ PARAM_KEYS = (
PARAM_TIMEOUT, PARAM_DISABLE_ROLLBACK, PARAM_ADOPT_STACK_DATA, PARAM_TIMEOUT, PARAM_DISABLE_ROLLBACK, PARAM_ADOPT_STACK_DATA,
PARAM_SHOW_DELETED, PARAM_SHOW_NESTED, PARAM_EXISTING, PARAM_SHOW_DELETED, PARAM_SHOW_NESTED, PARAM_EXISTING,
PARAM_CLEAR_PARAMETERS, PARAM_GLOBAL_TENANT, PARAM_LIMIT, 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', 'timeout_mins', 'disable_rollback', 'adopt_stack_data',
'show_deleted', 'show_nested', 'existing', 'show_deleted', 'show_nested', 'existing',
'clear_parameters', 'global_tenant', 'limit', 'clear_parameters', 'global_tenant', 'limit',
'nested_depth', 'tags' 'nested_depth', 'tags', 'show_hidden'
) )
STACK_KEYS = ( STACK_KEYS = (

View File

@ -607,7 +607,8 @@ class StackControllerTest(ControllerTest, common.HeatTestCase):
filters=mock.ANY, filters=mock.ANY,
tenant_safe=True, tenant_safe=True,
show_deleted=True, show_deleted=True,
show_nested=False) show_nested=False,
show_hidden=False)
@mock.patch.object(rpc_client.EngineClient, 'call') @mock.patch.object(rpc_client.EngineClient, 'call')
def test_detail(self, mock_call, mock_enforce): def test_detail(self, mock_call, mock_enforce):