summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavanum Srinivas <davanum@gmail.com>2016-02-24 09:41:58 -0800
committerDavanum Srinivas (dims) <davanum@gmail.com>2016-02-24 21:59:00 +0000
commit956e7b78f7e1aaa51284794c7e1a509e868904fd (patch)
tree26a8da813747cfc5f890cf9817ccbcfe2e4d1c75
parent921d79c98848b9b26628da177a5353ff1afd438d (diff)
downloadironic-956e7b78f7e1aaa51284794c7e1a509e868904fd.tar.gz
Tolerate roles in context.RequestContext
In Ia575ba803a0fb70f39146bd75d381ed19414bd23, oslo.context added roles support in the context itself. Once that change is released in oslo.context and the global requirements has been updated, we should switch to passing in the roles in the __init__ parameter. Until then we should set self.roles *after* the constructor since the constructor sets the roles to None when the new library gets released. Closes-Bug: 1549317 Change-Id: Ie28a4144ccac5d6894405ba7f801617376e35c51 (cherry picked from commit b0ae5e9f2dc078af8e80a284c8692b79e98e0ed2)
-rw-r--r--ironic/common/context.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/ironic/common/context.py b/ironic/common/context.py
index aaeffb333..ccd2222ea 100644
--- a/ironic/common/context.py
+++ b/ironic/common/context.py
@@ -33,18 +33,20 @@ class RequestContext(context.RequestContext):
before sending back to API call.
"""
- self.is_public_api = is_public_api
- self.domain_id = domain_id
- self.domain_name = domain_name
- self.roles = roles or []
- self.show_password = show_password
-
super(RequestContext, self).__init__(auth_token=auth_token,
user=user, tenant=tenant,
is_admin=is_admin,
read_only=read_only,
show_deleted=show_deleted,
request_id=request_id)
+ self.is_public_api = is_public_api
+ self.domain_id = domain_id
+ self.domain_name = domain_name
+ self.show_password = show_password
+ # NOTE(dims): roles was added in context.RequestContext recently.
+ # we should pass roles in __init__ above instead of setting the
+ # value here once the minimum version of oslo.context is updated.
+ self.roles = roles or []
def to_dict(self):
return {'auth_token': self.auth_token,