summaryrefslogtreecommitdiff
path: root/nova/context.py
diff options
context:
space:
mode:
authorSean Dague <sean@dague.net>2017-05-25 10:10:46 -0400
committerSean Dague <sean@dague.net>2017-05-25 10:37:26 -0400
commit39c279e2edc8657a8925fa2126a98f6a85e402a3 (patch)
tree96c470f285856aea377c5dc2bbcdd8680b37b50a /nova/context.py
parenta2beeab7204064aad33e51d10a39578f7802ae99 (diff)
downloadnova-39c279e2edc8657a8925fa2126a98f6a85e402a3.tar.gz
Have nova.context use super from_context
The nova.context should be a super set of oslo.context in all cases, especially after we've deserialized on the other side of the RPC bus. Our current code actually has a completely decoupled from_dict, which means that as fields are added to oslo.context we don't pick up any of those, and end up with a potentially broken and fragmented context on the workers. This fixes that by using the parent constructor for all the fields we can, and only explicitly load in a few fields that we also need. It also simplifies the testing so that we're just testing that our extra fields end up in the context, and not exact matching everything in the context, as oslo.context may add important things over time. Change-Id: Ie683adb36d5e2a736ddbf714524c9c18f3c0d69c
Diffstat (limited to 'nova/context.py')
-rw-r--r--nova/context.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/nova/context.py b/nova/context.py
index 42fff61e8e..6f59107695 100644
--- a/nova/context.py
+++ b/nova/context.py
@@ -204,21 +204,17 @@ class RequestContext(context.RequestContext):
@classmethod
def from_dict(cls, values):
- return cls(
+ return super(RequestContext, cls).from_dict(
+ values,
user_id=values.get('user_id'),
- user=values.get('user'),
project_id=values.get('project_id'),
- tenant=values.get('tenant'),
- is_admin=values.get('is_admin'),
+ # TODO(sdague): oslo.context has show_deleted, if
+ # possible, we should migrate to that in the future so we
+ # don't need to be different here.
read_deleted=values.get('read_deleted', 'no'),
- roles=values.get('roles'),
remote_address=values.get('remote_address'),
timestamp=values.get('timestamp'),
- request_id=values.get('request_id'),
- auth_token=values.get('auth_token'),
quota_class=values.get('quota_class'),
- user_name=values.get('user_name'),
- project_name=values.get('project_name'),
service_catalog=values.get('service_catalog'),
instance_lock_checked=values.get('instance_lock_checked', False),
)