Reduce log noise on expired tokens

If a token has expired, we now check the username field exists before
trying to len() it, thus reducing log noise.

Change-Id: Ie463607e4fb7ca671f9dad5559b87fe7721be4bd
Closes-Bug: #1319997
This commit is contained in:
Chris Jones 2014-05-15 16:39:09 -04:00
parent 3ca5ce4377
commit 0ba5334811
1 changed files with 3 additions and 3 deletions

View File

@ -253,11 +253,11 @@ class Auth(controller.V2Controller):
size=CONF.max_param_size)
username = auth['passwordCredentials'].get('username', '')
if len(username) > CONF.max_param_size:
raise exception.ValidationSizeError(attribute='username',
size=CONF.max_param_size)
if username:
if len(username) > CONF.max_param_size:
raise exception.ValidationSizeError(attribute='username',
size=CONF.max_param_size)
try:
user_ref = self.identity_api.get_user_by_name(
username, CONF.identity.default_domain_id)