Possible refactor of keystone.common.validate_token_bind's code
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Identity (keystone) |
Fix Released
|
Low
|
Steve Martinelli |
Bug Description
The part original code of keystone.
---
def validate_
...
bind = token_ref.bind
# permissive and strict modes don't require there to be a bind
permissive = bind_mode in ('permissive', 'strict')
# get the named mode if bind_mode is not one of the known
name = None if permissive or bind_mode == 'required' else bind_mode
if not bind:
if permissive:
# no bind provided and none required
return
else:
raise exception.
...
---
If the bind is None, It is not necessary to execute the "name = None if permissive or bind_mode == 'required' else bind_mode".
So It had better to adjust the sequence about the above code.
The changed code is as follows:
---
def validate_
...
bind = token_ref.bind
# permissive and strict modes don't require there to be a bind
permissive = bind_mode in ('permissive', 'strict')
if not bind:
if permissive:
# no bind provided and none required
return
else:
raise exception.
# get the named mode if bind_mode is not one of the known
name = None if permissive or bind_mode == 'required' else bind_mode
...
---
Changed in keystone: | |
assignee: | nobody → majianjun (mjjun) |
summary: |
- It had better to change the sequence of - keystone.common.validate_token_bind's code + Possible refactor of keystone.common.validate_token_bind's code |
Changed in keystone: | |
status: | Fix Committed → Fix Released |
Changed in keystone: | |
milestone: | none → mitaka-2 |
I've marked this as Low because there is no clear negative impact of the current code on end users (if there is some negative impact here, please describe it). If you're simply proposing a refactor, a bug report is unnecessary.