Merge "Remove tenant_safe flag from rpc and db api"
This commit is contained in:
commit
7c702887e3
|
@ -15,6 +15,7 @@ import six
|
|||
from webob import exc
|
||||
|
||||
from heat.api.openstack.v1 import util
|
||||
from heat.common import context
|
||||
from heat.common import param_utils
|
||||
from heat.common import serializers
|
||||
from heat.common import wsgi
|
||||
|
@ -43,20 +44,24 @@ class SoftwareConfigController(object):
|
|||
except ValueError as e:
|
||||
raise exc.HTTPBadRequest(six.text_type(e))
|
||||
|
||||
def _index(self, req, tenant_safe=True):
|
||||
def _index(self, req, use_admin_cnxt=False):
|
||||
whitelist = {
|
||||
'limit': util.PARAM_TYPE_SINGLE,
|
||||
'marker': util.PARAM_TYPE_SINGLE
|
||||
}
|
||||
params = util.get_allowed_params(req.params, whitelist)
|
||||
scs = self.rpc_client.list_software_configs(req.context,
|
||||
tenant_safe=tenant_safe,
|
||||
|
||||
if use_admin_cnxt:
|
||||
cnxt = context.get_admin_context()
|
||||
else:
|
||||
cnxt = req.context
|
||||
scs = self.rpc_client.list_software_configs(cnxt,
|
||||
**params)
|
||||
return {'software_configs': scs}
|
||||
|
||||
@util.policy_enforce
|
||||
def global_index(self, req):
|
||||
return self._index(req, tenant_safe=False)
|
||||
return self._index(req, use_admin_cnxt=True)
|
||||
|
||||
@util.policy_enforce
|
||||
def index(self, req):
|
||||
|
|
|
@ -21,6 +21,7 @@ from webob import exc
|
|||
|
||||
from heat.api.openstack.v1 import util
|
||||
from heat.api.openstack.v1.views import stacks_view
|
||||
from heat.common import context
|
||||
from heat.common import environment_format
|
||||
from heat.common.i18n import _
|
||||
from heat.common.i18n import _LW
|
||||
|
@ -196,7 +197,7 @@ class StackController(object):
|
|||
except ValueError as e:
|
||||
raise exc.HTTPBadRequest(six.text_type(e))
|
||||
|
||||
def _index(self, req, tenant_safe=True):
|
||||
def _index(self, req, use_admin_cnxt=False):
|
||||
filter_whitelist = {
|
||||
# usage of keys in this list are not encouraged, please use
|
||||
# rpc_api.STACK_KEYS instead
|
||||
|
@ -298,19 +299,23 @@ class StackController(object):
|
|||
if not filter_params:
|
||||
filter_params = None
|
||||
|
||||
stacks = self.rpc_client.list_stacks(req.context,
|
||||
filters=filter_params,
|
||||
tenant_safe=tenant_safe,
|
||||
**params)
|
||||
if use_admin_cnxt:
|
||||
cnxt = context.get_admin_context()
|
||||
include_project = True
|
||||
else:
|
||||
cnxt = req.context
|
||||
include_project = False
|
||||
|
||||
stacks = self.rpc_client.list_stacks(cnxt,
|
||||
filters=filter_params,
|
||||
**params)
|
||||
count = None
|
||||
if with_count:
|
||||
try:
|
||||
# Check if engine has been updated to a version with
|
||||
# support to count_stacks before trying to use it.
|
||||
count = self.rpc_client.count_stacks(req.context,
|
||||
count = self.rpc_client.count_stacks(cnxt,
|
||||
filters=filter_params,
|
||||
tenant_safe=tenant_safe,
|
||||
show_deleted=show_deleted,
|
||||
show_nested=show_nested,
|
||||
show_hidden=show_hidden,
|
||||
|
@ -321,12 +326,13 @@ class StackController(object):
|
|||
except AttributeError as ex:
|
||||
LOG.warning(_LW("Old Engine Version: %s"), ex)
|
||||
|
||||
return stacks_view.collection(req, stacks=stacks, count=count,
|
||||
tenant_safe=tenant_safe)
|
||||
return stacks_view.collection(req, stacks=stacks,
|
||||
count=count,
|
||||
include_project=include_project)
|
||||
|
||||
@util.policy_enforce
|
||||
def global_index(self, req):
|
||||
return self._index(req, tenant_safe=False)
|
||||
return self._index(req, use_admin_cnxt=True)
|
||||
|
||||
@util.policy_enforce
|
||||
def index(self, req):
|
||||
|
|
|
@ -35,7 +35,7 @@ basic_keys = (
|
|||
)
|
||||
|
||||
|
||||
def format_stack(req, stack, keys=None, tenant_safe=True):
|
||||
def format_stack(req, stack, keys=None, include_project=False):
|
||||
def transform(key, value):
|
||||
if keys and key not in keys:
|
||||
return
|
||||
|
@ -43,7 +43,7 @@ def format_stack(req, stack, keys=None, tenant_safe=True):
|
|||
if key == rpc_api.STACK_ID:
|
||||
yield ('id', value['stack_id'])
|
||||
yield ('links', [util.make_link(req, value)])
|
||||
if not tenant_safe:
|
||||
if include_project:
|
||||
yield ('project', value['tenant'])
|
||||
elif key == rpc_api.STACK_ACTION:
|
||||
return
|
||||
|
@ -63,9 +63,9 @@ def format_stack(req, stack, keys=None, tenant_safe=True):
|
|||
transform(k, v) for k, v in stack.items()))
|
||||
|
||||
|
||||
def collection(req, stacks, count=None, tenant_safe=True):
|
||||
def collection(req, stacks, count=None, include_project=False):
|
||||
keys = basic_keys
|
||||
formatted_stacks = [format_stack(req, s, keys, tenant_safe)
|
||||
formatted_stacks = [format_stack(req, s, keys, include_project)
|
||||
for s in stacks]
|
||||
|
||||
result = {'stacks': formatted_stacks}
|
||||
|
|
|
@ -156,9 +156,8 @@ def resource_get_by_physical_resource_id(context, physical_resource_id):
|
|||
physical_resource_id)
|
||||
|
||||
|
||||
def stack_get(context, stack_id, show_deleted=False, tenant_safe=True):
|
||||
return IMPL.stack_get(context, stack_id, show_deleted=show_deleted,
|
||||
tenant_safe=tenant_safe)
|
||||
def stack_get(context, stack_id, show_deleted=False):
|
||||
return IMPL.stack_get(context, stack_id, show_deleted=show_deleted)
|
||||
|
||||
|
||||
def stack_get_status(context, stack_id):
|
||||
|
@ -175,12 +174,12 @@ def stack_get_by_name(context, stack_name):
|
|||
|
||||
|
||||
def stack_get_all(context, limit=None, sort_keys=None, marker=None,
|
||||
sort_dir=None, filters=None, tenant_safe=True,
|
||||
sort_dir=None, filters=None,
|
||||
show_deleted=False, show_nested=False, show_hidden=False,
|
||||
tags=None, tags_any=None, not_tags=None,
|
||||
not_tags_any=None):
|
||||
return IMPL.stack_get_all(context, limit, sort_keys,
|
||||
marker, sort_dir, filters, tenant_safe,
|
||||
marker, sort_dir, filters,
|
||||
show_deleted, show_nested, show_hidden,
|
||||
tags, tags_any, not_tags, not_tags_any)
|
||||
|
||||
|
@ -189,12 +188,11 @@ def stack_get_all_by_owner_id(context, owner_id):
|
|||
return IMPL.stack_get_all_by_owner_id(context, owner_id)
|
||||
|
||||
|
||||
def stack_count_all(context, filters=None, tenant_safe=True,
|
||||
def stack_count_all(context, filters=None,
|
||||
show_deleted=False, show_nested=False, show_hidden=False,
|
||||
tags=None, tags_any=None, not_tags=None,
|
||||
not_tags_any=None):
|
||||
return IMPL.stack_count_all(context, filters=filters,
|
||||
tenant_safe=tenant_safe,
|
||||
show_deleted=show_deleted,
|
||||
show_nested=show_nested,
|
||||
show_hidden=show_hidden,
|
||||
|
@ -342,12 +340,10 @@ def software_config_get(context, config_id):
|
|||
return IMPL.software_config_get(context, config_id)
|
||||
|
||||
|
||||
def software_config_get_all(context, limit=None, marker=None,
|
||||
tenant_safe=True):
|
||||
def software_config_get_all(context, limit=None, marker=None):
|
||||
return IMPL.software_config_get_all(context,
|
||||
limit=limit,
|
||||
marker=marker,
|
||||
tenant_safe=tenant_safe)
|
||||
marker=marker)
|
||||
|
||||
|
||||
def software_config_delete(context, config_id):
|
||||
|
|
|
@ -432,7 +432,7 @@ def stack_get_by_name(context, stack_name):
|
|||
return query.first()
|
||||
|
||||
|
||||
def stack_get(context, stack_id, show_deleted=False, tenant_safe=True):
|
||||
def stack_get(context, stack_id, show_deleted=False):
|
||||
query = context.session.query(models.Stack).options(
|
||||
orm.joinedload("raw_template"))
|
||||
result = query.get(stack_id)
|
||||
|
@ -443,7 +443,7 @@ def stack_get(context, stack_id, show_deleted=False, tenant_safe=True):
|
|||
|
||||
# One exception to normal project scoping is users created by the
|
||||
# stacks in the stack_user_project_id (in the heat stack user domain)
|
||||
if (tenant_safe and result is not None
|
||||
if (result is not None
|
||||
and context is not None and not context.is_admin
|
||||
and context.tenant_id not in (result.tenant,
|
||||
result.stack_user_project_id)):
|
||||
|
@ -505,7 +505,7 @@ def _paginate_query(context, query, model, limit=None, sort_keys=None,
|
|||
return query
|
||||
|
||||
|
||||
def _query_stack_get_all(context, tenant_safe=True, show_deleted=False,
|
||||
def _query_stack_get_all(context, show_deleted=False,
|
||||
show_nested=False, show_hidden=False, tags=None,
|
||||
tags_any=None, not_tags=None, not_tags_any=None):
|
||||
if show_nested:
|
||||
|
@ -517,7 +517,7 @@ def _query_stack_get_all(context, tenant_safe=True, show_deleted=False,
|
|||
context, models.Stack, show_deleted=show_deleted
|
||||
).filter_by(owner_id=None)
|
||||
|
||||
if tenant_safe and not context.is_admin:
|
||||
if not context.is_admin:
|
||||
query = query.filter_by(tenant=context.tenant_id)
|
||||
|
||||
query = query.options(orm.subqueryload("tags"))
|
||||
|
@ -557,11 +557,11 @@ def _query_stack_get_all(context, tenant_safe=True, show_deleted=False,
|
|||
|
||||
|
||||
def stack_get_all(context, limit=None, sort_keys=None, marker=None,
|
||||
sort_dir=None, filters=None, tenant_safe=True,
|
||||
sort_dir=None, filters=None,
|
||||
show_deleted=False, show_nested=False, show_hidden=False,
|
||||
tags=None, tags_any=None, not_tags=None,
|
||||
not_tags_any=None):
|
||||
query = _query_stack_get_all(context, tenant_safe,
|
||||
query = _query_stack_get_all(context,
|
||||
show_deleted=show_deleted,
|
||||
show_nested=show_nested,
|
||||
show_hidden=show_hidden, tags=tags,
|
||||
|
@ -588,11 +588,11 @@ def _filter_and_page_query(context, query, limit=None, sort_keys=None,
|
|||
whitelisted_sort_keys, marker, sort_dir)
|
||||
|
||||
|
||||
def stack_count_all(context, filters=None, tenant_safe=True,
|
||||
def stack_count_all(context, filters=None,
|
||||
show_deleted=False, show_nested=False, show_hidden=False,
|
||||
tags=None, tags_any=None, not_tags=None,
|
||||
not_tags_any=None):
|
||||
query = _query_stack_get_all(context, tenant_safe=tenant_safe,
|
||||
query = _query_stack_get_all(context,
|
||||
show_deleted=show_deleted,
|
||||
show_nested=show_nested,
|
||||
show_hidden=show_hidden, tags=tags,
|
||||
|
@ -993,10 +993,9 @@ def software_config_get(context, config_id):
|
|||
return result
|
||||
|
||||
|
||||
def software_config_get_all(context, limit=None, marker=None,
|
||||
tenant_safe=True):
|
||||
def software_config_get_all(context, limit=None, marker=None):
|
||||
query = context.session.query(models.SoftwareConfig)
|
||||
if tenant_safe and not context.is_admin:
|
||||
if not context.is_admin:
|
||||
query = query.filter_by(tenant=context.tenant_id)
|
||||
return _paginate_query(context, query, models.SoftwareConfig,
|
||||
limit=limit, marker=marker).all()
|
||||
|
|
|
@ -299,7 +299,7 @@ class EngineService(service.Service):
|
|||
by the RPC caller.
|
||||
"""
|
||||
|
||||
RPC_API_VERSION = '1.32'
|
||||
RPC_API_VERSION = '1.33'
|
||||
|
||||
def __init__(self, host, topic):
|
||||
super(EngineService, self).__init__()
|
||||
|
@ -346,7 +346,6 @@ class EngineService(service.Service):
|
|||
admin_context = context.get_admin_context()
|
||||
stacks = stack_object.Stack.get_all(
|
||||
admin_context,
|
||||
tenant_safe=False,
|
||||
show_hidden=True)
|
||||
for s in stacks:
|
||||
self.stack_watch.start_watch_task(s.id, admin_context)
|
||||
|
@ -540,7 +539,8 @@ class EngineService(service.Service):
|
|||
:param sort_keys: an array of fields used to sort the list
|
||||
:param sort_dir: the direction of the sort ('asc' or 'desc')
|
||||
:param filters: a dict with attribute:value to filter the list
|
||||
:param tenant_safe: if true, scope the request by the current tenant
|
||||
:param tenant_safe: DEPRECATED, if true, scope the request by
|
||||
the current tenant
|
||||
:param show_deleted: if true, show soft-deleted stacks
|
||||
:param show_nested: if true, show nested stacks
|
||||
:param show_hidden: if true, show hidden stacks
|
||||
|
@ -557,6 +557,9 @@ class EngineService(service.Service):
|
|||
if filters is not None:
|
||||
filters = api.translate_filters(filters)
|
||||
|
||||
if not tenant_safe:
|
||||
cnxt = context.get_admin_context()
|
||||
|
||||
stacks = stack_object.Stack.get_all(
|
||||
cnxt,
|
||||
limit=limit,
|
||||
|
@ -564,7 +567,6 @@ class EngineService(service.Service):
|
|||
marker=marker,
|
||||
sort_dir=sort_dir,
|
||||
filters=filters,
|
||||
tenant_safe=tenant_safe,
|
||||
show_deleted=show_deleted,
|
||||
show_nested=show_nested,
|
||||
show_hidden=show_hidden,
|
||||
|
@ -583,7 +585,8 @@ class EngineService(service.Service):
|
|||
|
||||
:param cnxt: RPC context.
|
||||
:param filters: a dict of ATTR:VALUE to match against stacks
|
||||
:param tenant_safe: if true, scope the request by the current tenant
|
||||
:param tenant_safe: DEPRECATED, if true, scope the request by
|
||||
the current tenant
|
||||
:param show_deleted: if true, count will include the deleted stacks
|
||||
:param show_nested: if true, count will include nested stacks
|
||||
:param show_hidden: if true, count will include hidden stacks
|
||||
|
@ -597,10 +600,12 @@ class EngineService(service.Service):
|
|||
multiple tags using the boolean OR expression
|
||||
:returns: an integer representing the number of matched stacks
|
||||
"""
|
||||
if not tenant_safe:
|
||||
cnxt = context.get_admin_context()
|
||||
|
||||
return stack_object.Stack.count_all(
|
||||
cnxt,
|
||||
filters=filters,
|
||||
tenant_safe=tenant_safe,
|
||||
show_deleted=show_deleted,
|
||||
show_nested=show_nested,
|
||||
show_hidden=show_hidden,
|
||||
|
@ -2122,11 +2127,13 @@ class EngineService(service.Service):
|
|||
@context.request_context
|
||||
def list_software_configs(self, cnxt, limit=None, marker=None,
|
||||
tenant_safe=True):
|
||||
if not tenant_safe:
|
||||
cnxt = context.get_admin_context()
|
||||
|
||||
return self.software_config.list_software_configs(
|
||||
cnxt,
|
||||
limit=limit,
|
||||
marker=marker,
|
||||
tenant_safe=tenant_safe)
|
||||
marker=marker)
|
||||
|
||||
@context.request_context
|
||||
def create_software_config(self, cnxt, group, name, config,
|
||||
|
@ -2278,7 +2285,6 @@ class EngineService(service.Service):
|
|||
}
|
||||
stacks = stack_object.Stack.get_all(cnxt,
|
||||
filters=filters,
|
||||
tenant_safe=False,
|
||||
show_nested=True)
|
||||
for s in stacks:
|
||||
stack_id = s.id
|
||||
|
@ -2290,8 +2296,7 @@ class EngineService(service.Service):
|
|||
# refetch stack and confirm it is still IN_PROGRESS
|
||||
s = stack_object.Stack.get_by_id(
|
||||
cnxt,
|
||||
stack_id,
|
||||
tenant_safe=False)
|
||||
stack_id)
|
||||
if s.status != parser.Stack.IN_PROGRESS:
|
||||
lock.release()
|
||||
continue
|
||||
|
|
|
@ -43,13 +43,11 @@ class SoftwareConfigService(service.Service):
|
|||
sc = software_config_object.SoftwareConfig.get_by_id(cnxt, config_id)
|
||||
return api.format_software_config(sc)
|
||||
|
||||
def list_software_configs(self, cnxt, limit=None, marker=None,
|
||||
tenant_safe=True):
|
||||
def list_software_configs(self, cnxt, limit=None, marker=None):
|
||||
scs = software_config_object.SoftwareConfig.get_all(
|
||||
cnxt,
|
||||
limit=limit,
|
||||
marker=marker,
|
||||
tenant_safe=tenant_safe)
|
||||
marker=marker)
|
||||
result = [api.format_software_config(sc, detail=False) for sc in scs]
|
||||
return result
|
||||
|
||||
|
|
|
@ -62,14 +62,12 @@ class StackWatch(object):
|
|||
sid=stack_id)
|
||||
|
||||
def check_stack_watches(self, sid):
|
||||
# Retrieve the stored credentials & create context
|
||||
# Require tenant_safe=False to the stack_get to defeat tenant
|
||||
# Use admin_context for stack_get to defeat tenant
|
||||
# scoping otherwise we fail to retrieve the stack
|
||||
LOG.debug("Periodic watcher task for stack %s" % sid)
|
||||
admin_context = context.get_admin_context()
|
||||
db_stack = stack_object.Stack.get_by_id(admin_context,
|
||||
sid,
|
||||
tenant_safe=False)
|
||||
sid)
|
||||
if not db_stack:
|
||||
LOG.error(_LE("Unable to retrieve stack %s for periodic task"),
|
||||
sid)
|
||||
|
|
|
@ -503,7 +503,7 @@ class Stack(collections.Mapping):
|
|||
|
||||
@classmethod
|
||||
def load_all(cls, context, limit=None, marker=None, sort_keys=None,
|
||||
sort_dir=None, filters=None, tenant_safe=True,
|
||||
sort_dir=None, filters=None,
|
||||
show_deleted=False, resolve_data=True,
|
||||
show_nested=False, show_hidden=False, tags=None,
|
||||
tags_any=None, not_tags=None, not_tags_any=None):
|
||||
|
@ -514,7 +514,6 @@ class Stack(collections.Mapping):
|
|||
marker=marker,
|
||||
sort_dir=sort_dir,
|
||||
filters=filters,
|
||||
tenant_safe=tenant_safe,
|
||||
show_deleted=show_deleted,
|
||||
show_nested=show_nested,
|
||||
show_hidden=show_hidden,
|
||||
|
|
|
@ -63,7 +63,6 @@ class StackLock(object):
|
|||
return
|
||||
|
||||
stack = stack_object.Stack.get_by_id(self.context, self.stack_id,
|
||||
tenant_safe=False,
|
||||
show_deleted=True)
|
||||
if (lock_engine_id == self.engine_id or
|
||||
service_utils.engine_alive(self.context, lock_engine_id)):
|
||||
|
|
|
@ -112,7 +112,7 @@ class Stack(
|
|||
|
||||
@classmethod
|
||||
def get_all(cls, context, limit=None, sort_keys=None, marker=None,
|
||||
sort_dir=None, filters=None, tenant_safe=True,
|
||||
sort_dir=None, filters=None,
|
||||
show_deleted=False, show_nested=False, show_hidden=False,
|
||||
tags=None, tags_any=None, not_tags=None,
|
||||
not_tags_any=None):
|
||||
|
@ -123,7 +123,6 @@ class Stack(
|
|||
marker=marker,
|
||||
sort_dir=sort_dir,
|
||||
filters=filters,
|
||||
tenant_safe=tenant_safe,
|
||||
show_deleted=show_deleted,
|
||||
show_nested=show_nested,
|
||||
show_hidden=show_hidden,
|
||||
|
|
|
@ -54,6 +54,8 @@ class EngineClient(object):
|
|||
1.31 - Add nested_depth to list_events, when nested_depth is specified
|
||||
add root_stack_id to response
|
||||
1.32 - Add get_files call
|
||||
1.33 - Remove tenant_safe from list_stacks, count_stacks
|
||||
and list_software_configs
|
||||
"""
|
||||
|
||||
BASE_RPC_API_VERSION = '1.0'
|
||||
|
@ -116,7 +118,7 @@ class EngineClient(object):
|
|||
stack_name=stack_name))
|
||||
|
||||
def list_stacks(self, ctxt, limit=None, marker=None, sort_keys=None,
|
||||
sort_dir=None, filters=None, tenant_safe=True,
|
||||
sort_dir=None, filters=None,
|
||||
show_deleted=False, show_nested=False, show_hidden=False,
|
||||
tags=None, tags_any=None, not_tags=None,
|
||||
not_tags_any=None):
|
||||
|
@ -132,7 +134,6 @@ class EngineClient(object):
|
|||
:param sort_keys: an array of fields used to sort the list
|
||||
:param sort_dir: the direction of the sort ('asc' or 'desc')
|
||||
:param filters: a dict with attribute:value to filter the list
|
||||
:param tenant_safe: if true, scope the request by the current tenant
|
||||
:param show_deleted: if true, show soft-deleted stacks
|
||||
:param show_nested: if true, show nested stacks
|
||||
:param show_hidden: if true, show hidden stacks
|
||||
|
@ -150,16 +151,15 @@ class EngineClient(object):
|
|||
self.make_msg('list_stacks', limit=limit,
|
||||
sort_keys=sort_keys, marker=marker,
|
||||
sort_dir=sort_dir, filters=filters,
|
||||
tenant_safe=tenant_safe,
|
||||
show_deleted=show_deleted,
|
||||
show_nested=show_nested,
|
||||
show_hidden=show_hidden,
|
||||
tags=tags, tags_any=tags_any,
|
||||
not_tags=not_tags,
|
||||
not_tags_any=not_tags_any),
|
||||
version='1.8')
|
||||
version='1.33')
|
||||
|
||||
def count_stacks(self, ctxt, filters=None, tenant_safe=True,
|
||||
def count_stacks(self, ctxt, filters=None,
|
||||
show_deleted=False, show_nested=False, show_hidden=False,
|
||||
tags=None, tags_any=None, not_tags=None,
|
||||
not_tags_any=None):
|
||||
|
@ -167,7 +167,6 @@ class EngineClient(object):
|
|||
|
||||
:param ctxt: RPC context.
|
||||
:param filters: a dict of ATTR:VALUE to match against stacks
|
||||
:param tenant_safe: if true, scope the request by the current tenant
|
||||
:param show_deleted: if true, count will include the deleted stacks
|
||||
:param show_nested: if true, count will include nested stacks
|
||||
:param show_hidden: if true, count will include hidden stacks
|
||||
|
@ -183,7 +182,6 @@ class EngineClient(object):
|
|||
"""
|
||||
return self.call(ctxt, self.make_msg('count_stacks',
|
||||
filters=filters,
|
||||
tenant_safe=tenant_safe,
|
||||
show_deleted=show_deleted,
|
||||
show_nested=show_nested,
|
||||
show_hidden=show_hidden,
|
||||
|
@ -191,7 +189,7 @@ class EngineClient(object):
|
|||
tags_any=tags_any,
|
||||
not_tags=not_tags,
|
||||
not_tags_any=not_tags_any),
|
||||
version='1.8')
|
||||
version='1.33')
|
||||
|
||||
def show_stack(self, ctxt, stack_identity, resolve_outputs=True):
|
||||
"""Returns detailed information about one or all stacks.
|
||||
|
@ -711,14 +709,12 @@ class EngineClient(object):
|
|||
return self.call(cnxt, self.make_msg('show_software_config',
|
||||
config_id=config_id))
|
||||
|
||||
def list_software_configs(self, cnxt, limit=None, marker=None,
|
||||
tenant_safe=True):
|
||||
def list_software_configs(self, cnxt, limit=None, marker=None):
|
||||
return self.call(cnxt,
|
||||
self.make_msg('list_software_configs',
|
||||
limit=limit,
|
||||
marker=marker,
|
||||
tenant_safe=tenant_safe),
|
||||
version='1.10')
|
||||
marker=marker),
|
||||
version='1.33')
|
||||
|
||||
def create_software_config(self, cnxt, group, name, config,
|
||||
inputs=None, outputs=None, options=None):
|
||||
|
|
|
@ -163,13 +163,13 @@ class CfnStackControllerTest(common.HeatTestCase):
|
|||
u'StackStatus': u'CREATE_COMPLETE'}]}}}
|
||||
self.assertEqual(expected, result)
|
||||
default_args = {'limit': None, 'sort_keys': None, 'marker': None,
|
||||
'sort_dir': None, 'filters': None, 'tenant_safe': True,
|
||||
'sort_dir': None, 'filters': None,
|
||||
'show_deleted': False, 'show_nested': False,
|
||||
'show_hidden': False, 'tags': None,
|
||||
'tags_any': None, 'not_tags': None,
|
||||
'not_tags_any': None}
|
||||
mock_call.assert_called_once_with(
|
||||
dummy_req.context, ('list_stacks', default_args), version='1.8')
|
||||
dummy_req.context, ('list_stacks', default_args), version='1.33')
|
||||
|
||||
@mock.patch.object(rpc_client.EngineClient, 'call')
|
||||
def test_list_rmt_aterr(self, mock_call):
|
||||
|
@ -185,7 +185,7 @@ class CfnStackControllerTest(common.HeatTestCase):
|
|||
result = self.controller.list(dummy_req)
|
||||
self.assertIsInstance(result, exception.HeatInvalidParameterValueError)
|
||||
mock_call.assert_called_once_with(
|
||||
dummy_req.context, ('list_stacks', mock.ANY), version='1.8')
|
||||
dummy_req.context, ('list_stacks', mock.ANY), version='1.33')
|
||||
|
||||
@mock.patch.object(rpc_client.EngineClient, 'call')
|
||||
def test_list_rmt_interr(self, mock_call):
|
||||
|
@ -201,7 +201,7 @@ class CfnStackControllerTest(common.HeatTestCase):
|
|||
result = self.controller.list(dummy_req)
|
||||
self.assertIsInstance(result, exception.HeatInternalFailureError)
|
||||
mock_call.assert_called_once_with(
|
||||
dummy_req.context, ('list_stacks', mock.ANY), version='1.8')
|
||||
dummy_req.context, ('list_stacks', mock.ANY), version='1.33')
|
||||
|
||||
def test_describe_last_updated_time(self):
|
||||
params = {'Action': 'DescribeStacks'}
|
||||
|
|
|
@ -20,6 +20,7 @@ import webob.exc
|
|||
|
||||
import heat.api.middleware.fault as fault
|
||||
import heat.api.openstack.v1.stacks as stacks
|
||||
from heat.common import context
|
||||
from heat.common import exception as heat_exc
|
||||
from heat.common import identifier
|
||||
from heat.common import policy
|
||||
|
@ -294,13 +295,13 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
}
|
||||
self.assertEqual(expected, result)
|
||||
default_args = {'limit': None, 'sort_keys': None, 'marker': None,
|
||||
'sort_dir': None, 'filters': None, 'tenant_safe': True,
|
||||
'sort_dir': None, 'filters': None,
|
||||
'show_deleted': False, 'show_nested': False,
|
||||
'show_hidden': False, 'tags': None,
|
||||
'tags_any': None, 'not_tags': None,
|
||||
'not_tags_any': None}
|
||||
mock_call.assert_called_once_with(
|
||||
req.context, ('list_stacks', default_args), version='1.8')
|
||||
req.context, ('list_stacks', default_args), version='1.33')
|
||||
|
||||
@mock.patch.object(rpc_client.EngineClient, 'call')
|
||||
def test_index_whitelists_pagination_params(self, mock_call, mock_enforce):
|
||||
|
@ -319,13 +320,12 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
|
||||
rpc_call_args, _ = mock_call.call_args
|
||||
engine_args = rpc_call_args[1][1]
|
||||
self.assertEqual(13, len(engine_args))
|
||||
self.assertEqual(12, len(engine_args))
|
||||
self.assertIn('limit', engine_args)
|
||||
self.assertIn('sort_keys', engine_args)
|
||||
self.assertIn('marker', engine_args)
|
||||
self.assertIn('sort_dir', engine_args)
|
||||
self.assertIn('filters', engine_args)
|
||||
self.assertIn('tenant_safe', engine_args)
|
||||
self.assertNotIn('balrog', engine_args)
|
||||
|
||||
@mock.patch.object(rpc_client.EngineClient, 'call')
|
||||
|
@ -463,17 +463,18 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
scope=self.controller.REQUEST_SCOPE,
|
||||
context=self.context)
|
||||
|
||||
def test_global_index_sets_tenant_safe_to_false(self, mock_enforce):
|
||||
def test_global_index_uses_admin_context(self, mock_enforce):
|
||||
rpc_client = self.controller.rpc_client
|
||||
rpc_client.list_stacks = mock.Mock(return_value=[])
|
||||
rpc_client.count_stacks = mock.Mock()
|
||||
|
||||
mock_admin_ctxt = self.patchobject(context, 'get_admin_context')
|
||||
params = {'global_tenant': 'True'}
|
||||
req = self._get('/stacks', params=params)
|
||||
self.controller.index(req, tenant_id=self.tenant)
|
||||
rpc_client.list_stacks.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=False)
|
||||
filters=mock.ANY)
|
||||
self.assertEqual(1, mock_admin_ctxt.call_count)
|
||||
|
||||
def test_global_index_show_deleted_false(self, mock_enforce):
|
||||
rpc_client = self.controller.rpc_client
|
||||
|
@ -485,7 +486,6 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
self.controller.index(req, tenant_id=self.tenant)
|
||||
rpc_client.list_stacks.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_deleted=False)
|
||||
|
||||
def test_global_index_show_deleted_true(self, mock_enforce):
|
||||
|
@ -498,7 +498,6 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
self.controller.index(req, tenant_id=self.tenant)
|
||||
rpc_client.list_stacks.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_deleted=True)
|
||||
|
||||
def test_global_index_show_nested_false(self, mock_enforce):
|
||||
|
@ -511,7 +510,6 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
self.controller.index(req, tenant_id=self.tenant)
|
||||
rpc_client.list_stacks.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_nested=False)
|
||||
|
||||
def test_global_index_show_nested_true(self, mock_enforce):
|
||||
|
@ -524,7 +522,6 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
self.controller.index(req, tenant_id=self.tenant)
|
||||
rpc_client.list_stacks.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_nested=True)
|
||||
|
||||
def test_index_show_deleted_True_with_count_True(self, mock_enforce):
|
||||
|
@ -539,11 +536,9 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
self.assertEqual(0, result['count'])
|
||||
rpc_client.list_stacks.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_deleted=True)
|
||||
rpc_client.count_stacks.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_deleted=True,
|
||||
show_nested=False,
|
||||
show_hidden=False,
|
||||
|
@ -607,13 +602,13 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
|
||||
self.assertEqual(expected, result)
|
||||
default_args = {'limit': None, 'sort_keys': None, 'marker': None,
|
||||
'sort_dir': None, 'filters': None, 'tenant_safe': True,
|
||||
'sort_dir': None, 'filters': None,
|
||||
'show_deleted': False, 'show_nested': False,
|
||||
'show_hidden': False, 'tags': None,
|
||||
'tags_any': None, 'not_tags': None,
|
||||
'not_tags_any': None}
|
||||
mock_call.assert_called_once_with(
|
||||
req.context, ('list_stacks', default_args), version='1.8')
|
||||
req.context, ('list_stacks', default_args), version='1.33')
|
||||
|
||||
@mock.patch.object(rpc_client.EngineClient, 'call')
|
||||
def test_index_rmt_aterr(self, mock_call, mock_enforce):
|
||||
|
@ -629,7 +624,7 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
self.assertEqual(400, resp.json['code'])
|
||||
self.assertEqual('AttributeError', resp.json['error']['type'])
|
||||
mock_call.assert_called_once_with(
|
||||
req.context, ('list_stacks', mock.ANY), version='1.8')
|
||||
req.context, ('list_stacks', mock.ANY), version='1.33')
|
||||
|
||||
def test_index_err_denied_policy(self, mock_enforce):
|
||||
self._mock_enforce_setup(mock_enforce, 'index', False)
|
||||
|
@ -657,7 +652,7 @@ class StackControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
self.assertEqual(500, resp.json['code'])
|
||||
self.assertEqual('Exception', resp.json['error']['type'])
|
||||
mock_call.assert_called_once_with(
|
||||
req.context, ('list_stacks', mock.ANY), version='1.8')
|
||||
req.context, ('list_stacks', mock.ANY), version='1.33')
|
||||
|
||||
def test_create(self, mock_enforce):
|
||||
self._mock_enforce_setup(mock_enforce, 'create', True)
|
||||
|
|
|
@ -65,19 +65,19 @@ class TestFormatStack(common.HeatTestCase):
|
|||
self.assertNotIn('project', result)
|
||||
|
||||
@mock.patch.object(stacks_view, 'util', new=mock.Mock())
|
||||
def test_doesnt_add_project_if_tenant_safe(self):
|
||||
def test_doesnt_add_project_if_not_include_project(self):
|
||||
stack = {'stack_identity': {'stack_id': 'foo', 'tenant': 'bar'}}
|
||||
|
||||
result = stacks_view.format_stack(self.request, stack,
|
||||
None, tenant_safe=True)
|
||||
None, include_project=False)
|
||||
self.assertNotIn('project', result)
|
||||
|
||||
@mock.patch.object(stacks_view, 'util', new=mock.Mock())
|
||||
def test_adds_project_if_not_tenant_safe(self):
|
||||
def test_adds_project_if_include_project(self):
|
||||
stack = {'stack_identity': {'stack_id': 'foo', 'tenant': 'bar'}}
|
||||
|
||||
result = stacks_view.format_stack(self.request, stack,
|
||||
None, tenant_safe=False)
|
||||
None, include_project=True)
|
||||
self.assertIn('project', result)
|
||||
self.assertEqual('bar', result['project'])
|
||||
|
||||
|
|
|
@ -1827,10 +1827,6 @@ class DBAPIStackTest(common.HeatTestCase):
|
|||
def test_stack_get_can_return_a_stack_from_different_tenant(self):
|
||||
stack = create_stack(self.ctx, self.template, self.user_creds)
|
||||
self.ctx.tenant_id = 'abc'
|
||||
ret_stack = db_api.stack_get(self.ctx, stack.id,
|
||||
show_deleted=False, tenant_safe=False)
|
||||
self.assertEqual(stack.id, ret_stack.id)
|
||||
self.assertEqual('db_test_stack_name', ret_stack.name)
|
||||
|
||||
# with ctx.is_admin = True
|
||||
self.ctx.is_admin = True
|
||||
|
@ -1907,20 +1903,6 @@ class DBAPIStackTest(common.HeatTestCase):
|
|||
self.ctx.tenant = UUID3
|
||||
self.assertEqual([], db_api.stack_get_all(self.ctx))
|
||||
|
||||
def test_stack_get_all_with_tenant_safe_false(self):
|
||||
values = [
|
||||
{'tenant': UUID1},
|
||||
{'tenant': UUID1},
|
||||
{'tenant': UUID2},
|
||||
{'tenant': UUID2},
|
||||
{'tenant': UUID2},
|
||||
]
|
||||
[create_stack(self.ctx, self.template, self.user_creds,
|
||||
**val) for val in values]
|
||||
|
||||
stacks = db_api.stack_get_all(self.ctx, tenant_safe=False)
|
||||
self.assertEqual(5, len(stacks))
|
||||
|
||||
def test_stack_get_all_with_admin_context(self):
|
||||
values = [
|
||||
{'tenant': UUID1},
|
||||
|
@ -1953,7 +1935,7 @@ class DBAPIStackTest(common.HeatTestCase):
|
|||
self.ctx.tenant = UUID2
|
||||
self.assertEqual(3, db_api.stack_count_all(self.ctx))
|
||||
|
||||
def test_stack_count_all_with_tenant_safe_false(self):
|
||||
def test_stack_count_all_with_admin_context(self):
|
||||
values = [
|
||||
{'tenant': UUID1},
|
||||
{'tenant': UUID1},
|
||||
|
@ -1963,9 +1945,9 @@ class DBAPIStackTest(common.HeatTestCase):
|
|||
]
|
||||
[create_stack(self.ctx, self.template, self.user_creds,
|
||||
**val) for val in values]
|
||||
|
||||
self.ctx.is_admin = True
|
||||
self.assertEqual(5,
|
||||
db_api.stack_count_all(self.ctx, tenant_safe=False))
|
||||
db_api.stack_count_all(self.ctx))
|
||||
|
||||
def test_purge_deleted(self):
|
||||
now = timeutils.utcnow()
|
||||
|
@ -2053,6 +2035,7 @@ class DBAPIStackTest(common.HeatTestCase):
|
|||
|
||||
db_api.purge_deleted(age=3600, granularity='seconds')
|
||||
ctx = utils.dummy_context()
|
||||
ctx.is_admin = True
|
||||
self.assertIsNotNone(db_api.stack_get(ctx, stacks[0].id,
|
||||
show_deleted=True))
|
||||
self.assertIsNotNone(db_api.raw_template_get(ctx, templates[1].id))
|
||||
|
@ -2065,14 +2048,12 @@ class DBAPIStackTest(common.HeatTestCase):
|
|||
|
||||
db_api.purge_deleted(age=3600, granularity='seconds', project_id=UUID1)
|
||||
self.assertIsNotNone(db_api.stack_get(ctx, stacks[0].id,
|
||||
show_deleted=True,
|
||||
tenant_safe=False))
|
||||
show_deleted=True))
|
||||
self.assertIsNotNone(db_api.raw_template_get(ctx, templates[1].id))
|
||||
|
||||
db_api.purge_deleted(age=0, granularity='seconds', project_id=UUID2)
|
||||
self.assertIsNotNone(db_api.stack_get(ctx, stacks[0].id,
|
||||
show_deleted=True,
|
||||
tenant_safe=False))
|
||||
show_deleted=True))
|
||||
self.assertIsNotNone(db_api.raw_template_get(ctx, templates[1].id))
|
||||
|
||||
def test_dont_purge_shared_raw_template_files(self):
|
||||
|
@ -2140,16 +2121,15 @@ class DBAPIStackTest(common.HeatTestCase):
|
|||
|
||||
def _deleted_stack_existance(self, ctx, stacks,
|
||||
tmpl_files, existing, deleted):
|
||||
ctx.is_admin = True
|
||||
for s in existing:
|
||||
self.assertIsNotNone(db_api.stack_get(ctx, stacks[s].id,
|
||||
show_deleted=True,
|
||||
tenant_safe=False))
|
||||
show_deleted=True))
|
||||
self.assertIsNotNone(db_api.raw_template_files_get(
|
||||
ctx, tmpl_files[s].files_id))
|
||||
for s in deleted:
|
||||
self.assertIsNone(db_api.stack_get(ctx, stacks[s].id,
|
||||
show_deleted=True,
|
||||
tenant_safe=False))
|
||||
show_deleted=True))
|
||||
rt_id = stacks[s].raw_template_id
|
||||
self.assertRaises(exception.NotFound,
|
||||
db_api.raw_template_get, ctx, rt_id)
|
||||
|
|
|
@ -40,7 +40,7 @@ class ServiceEngineTest(common.HeatTestCase):
|
|||
|
||||
def test_make_sure_rpc_version(self):
|
||||
self.assertEqual(
|
||||
'1.32',
|
||||
'1.33',
|
||||
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 '
|
||||
|
|
|
@ -54,7 +54,7 @@ class StackWatchTest(common.HeatTestCase):
|
|||
self.eng.thread_group_mgr = None
|
||||
self._create_periodic_tasks()
|
||||
|
||||
mock_get_all.assert_called_once_with(mock.ANY, tenant_safe=False,
|
||||
mock_get_all.assert_called_once_with(mock.ANY,
|
||||
show_hidden=True)
|
||||
calls = start_watch_task.call_args_list
|
||||
self.assertEqual(2, start_watch_task.call_count)
|
||||
|
|
|
@ -494,7 +494,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
marker=marker,
|
||||
sort_dir=sort_dir,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=mock.ANY,
|
||||
|
@ -513,7 +512,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=filters,
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=mock.ANY,
|
||||
|
@ -533,43 +531,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=translated,
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=mock.ANY,
|
||||
tags=mock.ANY,
|
||||
tags_any=mock.ANY,
|
||||
not_tags=mock.ANY,
|
||||
not_tags_any=mock.ANY)
|
||||
|
||||
@mock.patch.object(stack_object.Stack, 'get_all')
|
||||
def test_stack_list_tenant_safe_defaults_to_true(self, mock_stack_get_all):
|
||||
self.eng.list_stacks(self.ctx)
|
||||
mock_stack_get_all.assert_called_once_with(self.ctx,
|
||||
limit=mock.ANY,
|
||||
sort_keys=mock.ANY,
|
||||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=mock.ANY,
|
||||
tags=mock.ANY,
|
||||
tags_any=mock.ANY,
|
||||
not_tags=mock.ANY,
|
||||
not_tags_any=mock.ANY)
|
||||
|
||||
@mock.patch.object(stack_object.Stack, 'get_all')
|
||||
def test_stack_list_passes_tenant_safe_info(self, mock_stack_get_all):
|
||||
self.eng.list_stacks(self.ctx, tenant_safe=False)
|
||||
mock_stack_get_all.assert_called_once_with(self.ctx,
|
||||
limit=mock.ANY,
|
||||
sort_keys=mock.ANY,
|
||||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=False,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=mock.ANY,
|
||||
|
@ -587,7 +548,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=True,
|
||||
show_hidden=mock.ANY,
|
||||
|
@ -605,7 +565,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=True,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=mock.ANY,
|
||||
|
@ -623,7 +582,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=True,
|
||||
|
@ -641,7 +599,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=mock.ANY,
|
||||
|
@ -659,7 +616,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=mock.ANY,
|
||||
|
@ -677,7 +633,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=mock.ANY,
|
||||
|
@ -695,7 +650,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
marker=mock.ANY,
|
||||
sort_dir=mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=mock.ANY,
|
||||
show_nested=mock.ANY,
|
||||
show_hidden=mock.ANY,
|
||||
|
@ -709,35 +663,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
self.eng.count_stacks(self.ctx, filters={'foo': 'bar'})
|
||||
mock_stack_count_all.assert_called_once_with(mock.ANY,
|
||||
filters={'foo': 'bar'},
|
||||
tenant_safe=mock.ANY,
|
||||
show_deleted=False,
|
||||
show_nested=False,
|
||||
show_hidden=False,
|
||||
tags=None,
|
||||
tags_any=None,
|
||||
not_tags=None,
|
||||
not_tags_any=None)
|
||||
|
||||
@mock.patch.object(stack_object.Stack, 'count_all')
|
||||
def test_count_stacks_tenant_safe_default_true(self, mock_stack_count_all):
|
||||
self.eng.count_stacks(self.ctx)
|
||||
mock_stack_count_all.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_deleted=False,
|
||||
show_nested=False,
|
||||
show_hidden=False,
|
||||
tags=None,
|
||||
tags_any=None,
|
||||
not_tags=None,
|
||||
not_tags_any=None)
|
||||
|
||||
@mock.patch.object(stack_object.Stack, 'count_all')
|
||||
def test_count_stacks_passes_tenant_safe_info(self, mock_stack_count_all):
|
||||
self.eng.count_stacks(self.ctx, tenant_safe=False)
|
||||
mock_stack_count_all.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=False,
|
||||
show_deleted=False,
|
||||
show_nested=False,
|
||||
show_hidden=False,
|
||||
|
@ -751,7 +676,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
self.eng.count_stacks(self.ctx, show_nested=True)
|
||||
mock_stack_count_all.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_deleted=False,
|
||||
show_nested=True,
|
||||
show_hidden=False,
|
||||
|
@ -765,7 +689,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
self.eng.count_stacks(self.ctx, show_deleted=True)
|
||||
mock_stack_count_all.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_deleted=True,
|
||||
show_nested=False,
|
||||
show_hidden=False,
|
||||
|
@ -779,7 +702,6 @@ class StackServiceTest(common.HeatTestCase):
|
|||
self.eng.count_stacks(self.ctx, show_hidden=True)
|
||||
mock_stack_count_all.assert_called_once_with(mock.ANY,
|
||||
filters=mock.ANY,
|
||||
tenant_safe=True,
|
||||
show_deleted=False,
|
||||
show_nested=False,
|
||||
show_hidden=True,
|
||||
|
@ -1382,11 +1304,10 @@ class StackServiceTest(common.HeatTestCase):
|
|||
}
|
||||
mock_get_all.assert_called_once_with(self.ctx,
|
||||
filters=filters,
|
||||
tenant_safe=False,
|
||||
show_nested=True)
|
||||
mock_get_by_id.assert_has_calls([
|
||||
mock.call(self.ctx, 'foo', tenant_safe=False),
|
||||
mock.call(self.ctx, 'bar', tenant_safe=False),
|
||||
mock.call(self.ctx, 'foo'),
|
||||
mock.call(self.ctx, 'bar'),
|
||||
])
|
||||
mock_stack_load.assert_called_once_with(self.ctx,
|
||||
stack=db_stack,
|
||||
|
|
|
@ -112,7 +112,6 @@ class EngineRpcAPITestCase(common.HeatTestCase):
|
|||
'marker': mock.ANY,
|
||||
'sort_dir': mock.ANY,
|
||||
'filters': mock.ANY,
|
||||
'tenant_safe': mock.ANY,
|
||||
'show_deleted': mock.ANY,
|
||||
'show_nested': mock.ANY,
|
||||
'show_hidden': mock.ANY,
|
||||
|
@ -126,7 +125,6 @@ class EngineRpcAPITestCase(common.HeatTestCase):
|
|||
def test_count_stacks(self):
|
||||
default_args = {
|
||||
'filters': mock.ANY,
|
||||
'tenant_safe': mock.ANY,
|
||||
'show_deleted': mock.ANY,
|
||||
'show_nested': mock.ANY,
|
||||
'show_hidden': mock.ANY,
|
||||
|
@ -306,8 +304,7 @@ class EngineRpcAPITestCase(common.HeatTestCase):
|
|||
|
||||
def test_list_software_configs(self):
|
||||
self._test_engine_api('list_software_configs', 'call',
|
||||
limit=mock.ANY, marker=mock.ANY,
|
||||
tenant_safe=mock.ANY)
|
||||
limit=mock.ANY, marker=mock.ANY)
|
||||
|
||||
def test_show_software_config(self):
|
||||
self._test_engine_api('show_software_config', 'call',
|
||||
|
|
|
@ -62,7 +62,6 @@ class StackLockTest(common.HeatTestCase):
|
|||
self.mock_get_by_id.assert_called_once_with(
|
||||
self.context,
|
||||
self.stack_id,
|
||||
tenant_safe=False,
|
||||
show_deleted=True)
|
||||
mock_create.assert_called_once_with(
|
||||
self.context, self.stack_id, self.engine_id)
|
||||
|
@ -97,7 +96,6 @@ class StackLockTest(common.HeatTestCase):
|
|||
self.mock_get_by_id.assert_called_once_with(
|
||||
self.context,
|
||||
self.stack_id,
|
||||
tenant_safe=False,
|
||||
show_deleted=True)
|
||||
|
||||
mock_create.assert_called_once_with(
|
||||
|
@ -118,7 +116,6 @@ class StackLockTest(common.HeatTestCase):
|
|||
self.mock_get_by_id.assert_called_once_with(
|
||||
self.context,
|
||||
self.stack_id,
|
||||
tenant_safe=False,
|
||||
show_deleted=True)
|
||||
|
||||
mock_create.assert_called_once_with(
|
||||
|
@ -160,7 +157,6 @@ class StackLockTest(common.HeatTestCase):
|
|||
self.mock_get_by_id.assert_called_with(
|
||||
self.context,
|
||||
self.stack_id,
|
||||
tenant_safe=False,
|
||||
show_deleted=True)
|
||||
|
||||
mock_create.assert_has_calls(
|
||||
|
|
Loading…
Reference in New Issue