Purge more tenant_id references that I missed

Change-Id: I3adfeec5d4512bba9e7a640653346addb5eb3d19
This commit is contained in:
Adam Harwell 2017-05-04 15:36:05 -07:00
parent fa6e02cc8d
commit ed8867692f
15 changed files with 22 additions and 55 deletions

View File

@ -63,16 +63,15 @@ class HealthMonitorController(base.BaseController):
db_hm, hm_types.HealthMonitorResponse)
return hm_types.HealthMonitorRootResponse(healthmonitor=result)
@wsme_pecan.wsexpose(hm_types.HealthMonitorsRootResponse, wtypes.text,
wtypes.text)
def get_all(self, tenant_id=None, project_id=None):
@wsme_pecan.wsexpose(hm_types.HealthMonitorsRootResponse, wtypes.text)
def get_all(self, project_id=None):
"""Gets a single health monitor's details."""
# NOTE(blogan): since a pool can only have one health monitor
# we are using the get_all method to only get the single health monitor
context = pecan.request.context.get('octavia_context')
if context.is_admin or CONF.auth_strategy == constants.NOAUTH:
if project_id or tenant_id:
project_id = {'project_id': project_id or tenant_id}
if project_id:
project_id = {'project_id': project_id}
else:
project_id = {}
else:

View File

@ -52,14 +52,13 @@ class L7PolicyController(base.BaseController):
l7policy_types.L7PolicyResponse)
return l7policy_types.L7PolicyRootResponse(l7policy=result)
@wsme_pecan.wsexpose(l7policy_types.L7PoliciesRootResponse, wtypes.text,
wtypes.text)
def get_all(self, tenant_id=None, project_id=None):
@wsme_pecan.wsexpose(l7policy_types.L7PoliciesRootResponse, wtypes.text)
def get_all(self, project_id=None):
"""Lists all l7policies of a listener."""
context = pecan.request.context.get('octavia_context')
if context.is_admin or CONF.auth_strategy == constants.NOAUTH:
if project_id or tenant_id:
project_id = {'project_id': project_id or tenant_id}
if project_id:
project_id = {'project_id': project_id}
else:
project_id = {}
else:

View File

@ -64,14 +64,13 @@ class ListenersController(base.BaseController):
listener_types.ListenerResponse)
return listener_types.ListenerRootResponse(listener=result)
@wsme_pecan.wsexpose(listener_types.ListenersRootResponse,
wtypes.text, wtypes.text)
def get_all(self, tenant_id=None, project_id=None):
@wsme_pecan.wsexpose(listener_types.ListenersRootResponse, wtypes.text)
def get_all(self, project_id=None):
"""Lists all listeners."""
context = pecan.request.context.get('octavia_context')
if context.is_admin or CONF.auth_strategy == constants.NOAUTH:
if project_id or tenant_id:
project_id = {'project_id': project_id or tenant_id}
if project_id:
project_id = {'project_id': project_id}
else:
project_id = {}
else:

View File

@ -52,17 +52,13 @@ class LoadBalancersController(base.BaseController):
lb_types.LoadBalancerResponse)
return lb_types.LoadBalancerRootResponse(loadbalancer=result)
@wsme_pecan.wsexpose(lb_types.LoadBalancersRootResponse, wtypes.text,
wtypes.text)
def get_all(self, tenant_id=None, project_id=None):
@wsme_pecan.wsexpose(lb_types.LoadBalancersRootResponse, wtypes.text)
def get_all(self, project_id=None):
"""Lists all load balancers."""
# NOTE(blogan): tenant_id and project_id are optional query parameters
# tenant_id and project_id are the same thing. tenant_id will be kept
# around for a long amount of time.
context = pecan.request.context.get('octavia_context')
if context.is_admin or CONF.auth_strategy == constants.NOAUTH:
if project_id or tenant_id:
project_id = {'project_id': project_id or tenant_id}
if project_id:
project_id = {'project_id': project_id}
else:
project_id = {}
else:
@ -117,8 +113,6 @@ class LoadBalancersController(base.BaseController):
if context.is_admin or CONF.auth_strategy == constants.NOAUTH:
if load_balancer.project_id:
project_id = load_balancer.project_id
elif load_balancer.tenant_id:
project_id = load_balancer.tenant_id
if not project_id:
raise exceptions.ValidationException(detail=_(

View File

@ -52,14 +52,13 @@ class PoolsController(base.BaseController):
result = self._convert_db_to_type(db_pool, pool_types.PoolResponse)
return pool_types.PoolRootResponse(pool=result)
@wsme_pecan.wsexpose(pool_types.PoolsRootResponse, wtypes.text,
wtypes.text)
def get_all(self, tenant_id=None, project_id=None):
@wsme_pecan.wsexpose(pool_types.PoolsRootResponse, wtypes.text)
def get_all(self, project_id=None):
"""Lists all pools."""
context = pecan.request.context.get('octavia_context')
if context.is_admin or CONF.auth_strategy == constants.NOAUTH:
if project_id or tenant_id:
project_id = {'project_id': project_id or tenant_id}
if project_id:
project_id = {'project_id': project_id}
else:
project_id = {}
else:

View File

@ -93,8 +93,6 @@ class HealthMonitorPOST(BaseHealthMonitorType):
admin_state_up = wtypes.wsattr(bool, default=True)
# TODO(johnsom) Remove after deprecation (R series)
project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
# TODO(johnsom) Remove after deprecation (R series)
tenant_id = wtypes.wsattr(wtypes.StringType(max_length=36))
pool_id = wtypes.wsattr(wtypes.UuidType(), mandatory=True)

View File

@ -72,8 +72,6 @@ class L7PolicyPOST(BaseL7PolicyType):
admin_state_up = wtypes.wsattr(bool, default=True)
# TODO(johnsom) Remove after deprecation (R series)
project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
# TODO(johnsom) Remove after deprecation (R series)
tenant_id = wtypes.wsattr(wtypes.StringType(max_length=36))
action = wtypes.wsattr(
wtypes.Enum(str, *constants.SUPPORTED_L7POLICY_ACTIONS),
mandatory=True)

View File

@ -68,8 +68,6 @@ class L7RulePOST(BaseL7Type):
admin_state_up = wtypes.wsattr(bool, default=True)
# TODO(johnsom) Remove after deprecation (R series)
project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
# TODO(johnsom) Remove after deprecation (R series)
tenant_id = wtypes.wsattr(wtypes.StringType(max_length=36))
class L7RuleRootPOST(types.BaseType):

View File

@ -99,8 +99,6 @@ class ListenerPOST(BaseListenerType):
sni_container_refs = [wtypes.StringType(max_length=255)]
# TODO(johnsom) Remove after deprecation (R series)
project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
# TODO(johnsom) Remove after deprecation (R series)
tenant_id = wtypes.wsattr(wtypes.StringType(max_length=36))
default_pool_id = wtypes.wsattr(wtypes.UuidType())
default_pool = wtypes.wsattr(pool.PoolPOST)
l7policies = wtypes.wsattr([l7policy.L7PolicyPOST], default=[])

View File

@ -86,7 +86,6 @@ class LoadBalancerPOST(BaseLoadBalancerType):
vip_subnet_id = wtypes.wsattr(wtypes.UuidType())
vip_network_id = wtypes.wsattr(wtypes.UuidType())
project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
tenant_id = wtypes.wsattr(wtypes.StringType(max_length=36))
listeners = wtypes.wsattr([listener.ListenerPOST], default=[])

View File

@ -69,8 +69,6 @@ class MemberPOST(BaseMemberType):
subnet_id = wtypes.wsattr(wtypes.UuidType())
# TODO(johnsom) Remove after deprecation (R series)
project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
# TODO(johnsom) Remove after deprecation (R series)
tenant_id = wtypes.wsattr(wtypes.StringType(max_length=36))
class MemberRootPOST(types.BaseType):

View File

@ -122,8 +122,6 @@ class PoolPOST(BasePoolType):
session_persistence = wtypes.wsattr(SessionPersistencePOST)
# TODO(johnsom) Remove after deprecation (R series)
project_id = wtypes.wsattr(wtypes.StringType(max_length=36))
# TODO(johnsom) Remove after deprecation (R series)
tenant_id = wtypes.wsattr(wtypes.StringType(max_length=36))
health_monitor = wtypes.wsattr(health_monitor.HealthMonitorPOST)
members = wtypes.wsattr([member.MemberPOST])

View File

@ -47,7 +47,6 @@ class QuotaResponse(base.BaseType):
class QuotaAllBase(base.BaseType):
"""Wrapper object for get all quotas responses."""
project_id = wtypes.wsattr(wtypes.StringType())
tenant_id = wtypes.wsattr(wtypes.StringType())
load_balancer = wtypes.wsattr(wtypes.IntegerType())
listener = wtypes.wsattr(wtypes.IntegerType())
member = wtypes.wsattr(wtypes.IntegerType())
@ -58,7 +57,6 @@ class QuotaAllBase(base.BaseType):
def from_data_model(cls, data_model, children=False):
quotas = super(QuotaAllBase, cls).from_data_model(
data_model, children=children)
quotas.tenant_id = quotas.project_id
return quotas

View File

@ -232,15 +232,9 @@ class TestLoadBalancer(base.BaseAPITest):
lb_json = {'vip_subnet_id': 'HI'}
self.post(self.LBS_PATH, lb_json, status=400)
def test_create_with_tenant_id(self):
tenant_id = uuidutils.generate_uuid()
api_lb = self.test_create(tenant_id=tenant_id, project_id=None)
self.assertEqual(tenant_id, api_lb.get('project_id'))
def test_create_with_project_and_tenant_id(self):
def test_create_with_project_id(self):
project_id = uuidutils.generate_uuid()
api_lb = self.test_create(tenant_id=uuidutils.generate_uuid(),
project_id=project_id)
api_lb = self.test_create(project_id=project_id)
self.assertEqual(project_id, api_lb.get('project_id'))
def test_get_all_admin(self):

View File

@ -88,9 +88,7 @@ class TestQuotas(base.BaseAPITest):
quota_list = response.json
quota1['project_id'] = project_id1
quota1['tenant_id'] = project_id1
quota2['project_id'] = project_id2
quota2['tenant_id'] = project_id2
expected = {'quotas': [quota1, quota2]}
self.assertEqual(expected, quota_list)