summaryrefslogtreecommitdiff
path: root/nova/context.py
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2012-03-08 00:07:30 -0800
committerChris Behrens <cbehrens@codestud.com>2012-03-08 08:32:36 -0800
commiteba95d1e42992056edf6f0d6f84e8e230f331cd7 (patch)
tree49a9c7f0ba60fd712c08d7519d7a10b25b7292df /nova/context.py
parent10c568aacdb4f2b1eb816097ddfffd6092249f5e (diff)
downloadnova-eba95d1e42992056edf6f0d6f84e8e230f331cd7.tar.gz
Add kwargs to RequestContext __init__
Fixes bug 949726 This allows processing of rpc messages that contain older versions of RequestContext to not raise an exception. Change-Id: I4891a44280fcb8accf0cef1c00c1123029abcc96
Diffstat (limited to 'nova/context.py')
-rw-r--r--nova/context.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/nova/context.py b/nova/context.py
index f83d8fd759..c5c3162fb4 100644
--- a/nova/context.py
+++ b/nova/context.py
@@ -22,9 +22,13 @@
import copy
from nova import local
+from nova import log as logging
from nova import utils
+LOG = logging.getLogger(__name__)
+
+
def generate_request_id():
return 'req-' + str(utils.gen_uuid())
@@ -38,7 +42,7 @@ class RequestContext(object):
def __init__(self, user_id, project_id, is_admin=None, read_deleted="no",
roles=None, remote_address=None, timestamp=None,
- request_id=None, auth_token=None, overwrite=True):
+ request_id=None, auth_token=None, overwrite=True, **kwargs):
"""
:param read_deleted: 'no' indicates deleted records are hidden, 'yes'
indicates deleted records are visible, 'only' indicates that
@@ -46,10 +50,16 @@ class RequestContext(object):
:param overwrite: Set to False to ensure that the greenthread local
copy of the index is not overwritten.
+
+ :param kwargs: Extra arguments that might be present, but we ignore
+ because they possibly came in from older rpc messages.
"""
if read_deleted not in ('no', 'yes', 'only'):
raise ValueError(_("read_deleted can only be one of 'no', "
"'yes' or 'only', not %r") % read_deleted)
+ if kwargs:
+ LOG.warn(_('Arguments dropped when creating context: %s') %
+ str(kwargs))
self.user_id = user_id
self.project_id = project_id