diff options
author | Jamie Lennox <jamielennox@gmail.com> | 2017-08-29 08:48:33 +1000 |
---|---|---|
committer | Jamie Lennox <jamielennox@gmail.com> | 2017-08-29 08:48:33 +1000 |
commit | 5ec88acbe25e315c9b16a8bd9c064b92e16751c6 (patch) | |
tree | 1fa6018feb90c9c8ff4bbf098c02e227b80a5551 /nova/context.py | |
parent | 6119f6ff516c0092ecf17e9da1b05f0f8b7f4193 (diff) | |
download | nova-5ec88acbe25e315c9b16a8bd9c064b92e16751c6.tar.gz |
Remove unneeded attributes from context
In the last few cycles oslo.context has picked up a standard way of
representing most of the information available from a token context.
There's no more need for nova to manage these properties. Remove
properties that shadow the base oslo.context properties and helpers that
we don't need.
Change-Id: I1b11e405232b1acee053cb3bd30c18202d3b7c8f
Diffstat (limited to 'nova/context.py')
-rw-r--r-- | nova/context.py | 39 |
1 files changed, 2 insertions, 37 deletions
diff --git a/nova/context.py b/nova/context.py index b47b63f985..03cb953790 100644 --- a/nova/context.py +++ b/nova/context.py @@ -88,9 +88,8 @@ class RequestContext(context.RequestContext): def __init__(self, user_id=None, project_id=None, is_admin=None, read_deleted="no", remote_address=None, timestamp=None, - quota_class=None, user_name=None, project_name=None, - service_catalog=None, instance_lock_checked=False, - user_auth_plugin=None, **kwargs): + quota_class=None, service_catalog=None, + instance_lock_checked=False, user_auth_plugin=None, **kwargs): """:param read_deleted: 'no' indicates deleted records are hidden, 'yes' indicates deleted records are visible, 'only' indicates that *only* deleted records are visible. @@ -131,8 +130,6 @@ class RequestContext(context.RequestContext): # rs_limits turnstile pre-processor. # See https://lists.launchpad.net/openstack/msg12200.html self.quota_class = quota_class - self.user_name = user_name - self.project_name = project_name # NOTE(dheeraj): The following attributes are used by cellsv2 to store # connection information for connecting to the target cell. @@ -166,25 +163,6 @@ class RequestContext(context.RequestContext): read_deleted = property(_get_read_deleted, _set_read_deleted, _del_read_deleted) - # FIXME(dims): user_id and project_id duplicate information that is - # already present in the oslo_context's RequestContext. We need to - # get rid of them. - @property - def project_id(self): - return self.tenant - - @project_id.setter - def project_id(self, value): - self.tenant = value - - @property - def user_id(self): - return self.user - - @user_id.setter - def user_id(self, value): - self.user = value - def to_dict(self): values = super(RequestContext, self).to_dict() # FIXME(dims): defensive hasattr() checks need to be @@ -232,19 +210,6 @@ class RequestContext(context.RequestContext): instance_lock_checked=values.get('instance_lock_checked', False), ) - @classmethod - def from_environ(cls, environ, **kwargs): - ctx = super(RequestContext, cls).from_environ(environ, **kwargs) - - # the base oslo.context sets its user param and tenant param but not - # our user_id and project_id param so fix those up. - if ctx.user and not ctx.user_id: - ctx.user_id = ctx.user - if ctx.tenant and not ctx.project_id: - ctx.project_id = ctx.tenant - - return ctx - def elevated(self, read_deleted=None): """Return a version of this context with admin flag set.""" context = copy.copy(self) |