refactor: move variable to where it's needed

the `name` variable wasn't needed before the conditional, bump
it down.

Change-Id: I688b6f902f40536f88f51b4e7e47d049573bdbc5
Closes-Bug: 1488451
This commit is contained in:
Steve Martinelli 2015-11-30 02:38:57 -05:00
parent 8f30e9a078
commit 6977f908fe
1 changed files with 3 additions and 3 deletions

View File

@ -71,9 +71,6 @@ def validate_token_bind(context, token_ref):
# 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
@ -82,6 +79,9 @@ def validate_token_bind(context, token_ref):
LOG.info(_LI("No bind information present in token"))
raise exception.Unauthorized()
# 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 name and name not in bind:
LOG.info(_LI("Named bind mode %s not in bind information"), name)
raise exception.Unauthorized()