Move all opens in auth_token to be in context

This commit switches the use of open() to be in a with context. This
will prevent leaking file descriptors because using a context
provides an inherent close(). Prior to this commit it was possible
that an exception or error during the write() call could prevent
close() from running.

Change-Id: Ib13fe651d41f0eafea23a1c96c6c64d405de7e49
Move flake8 option from run_tests.sh to tox.ini

flake8 will read the section [flake8] of tox.ini to guide the behavior.
In run_tests.sh, there is no need to add flake8 option in run_flake8()
function.

Bug #1214175

Change-Id: If3b84a0a3eecc1a9800fed6be9b24e648c161280
Use hashed token for invalid PKI token cache key

Invalid PKI tokens are cached in memcache using the entire token as
key. This triggers the familiar memcache key length error since a
PKI token is much longer than 250 characters.

This change hashes the token before using it as a key, and also changes
instances of "token" to "token_id" where appropriate so it's clear
that we're passing around a hashed token rather than the token data
itself.

Change-Id: I765b209578d60266da706094f61d8d9b15cfb6de
Closes-bug: 1206347
Add apiclient.exceptions hierarchy

The new apiclient.exceptions hierarchy is more comprehensive
and it covers almost all HTTP error status codes. These
exceptions can be used in novaclient, keystoneclient,
glanceclient, and other client projects thus providing a
single inteface.

Users can have benefit from OpenStack clients raising exceptions
of known classes while now every client has its own classes making
difficult to catch, e.g., NotFound for every client.

Change-Id: Ia7b25880e0ffca3526525a0f0e77c7e77c4f0076
Synchronize code from oslo

Use commit 376d1aaef9928a0cacb6ff8361b7b5003cad1e0a
'Merge "Update DB maintainers"'
by jenkins
on Tue Aug 20 12:08:26 2013 +0000

Changes:
- Ibf3c56e4baa6ad83e2b95a948787e9d02cf074d4 BaseException.message is deprecated since Python 2.6
- I24ffad9ab7852be44e5d6c8805aa0a47647e21cc Don't attempt to patch eventlet without the patch
- I838559f6f308e4a0c255af7bc27cdc669c5cf5f3 Ensure install_venv works behind firewalls

Change-Id: I70182bd4e6611ee6da58d2772767888608c0f80c
Add importutils and strutils from oslo

They will be used by apiclient library.

Change-Id: Ifb0d5fa1480c3701316b57d9e59507d608b11753
Allow configure the number of http retries

Allow setting the maximum number of times we want to retry to
http_connect when communicating with the Identity service.

Closes-Bug: 1209194
Change-Id: I56bff55dc808a1188d42f1643a8018a8d49012c6
Add unittests for exceptions.EmptyCatalog

Change-Id: I6cff9501883ba2237e3112a53e01f994f170aadf
Merge "Allow configure the number of http retries"
Merge "Add importutils and strutils from oslo"
Merge "Move all opens in auth_token to be in context"
clearer error when authenticate called without auth_url

Fixes bug #1212729

Change-Id: Icd55b77fcd58db182e5c0fe0c230e7fc9d8a57ff
Merge "Add unittests for exceptions.EmptyCatalog"
Update oslo.config

Update oslo.config to 1.2.0a3 it contains a bucket load of
python3 fixes that is needed for py3 compat in python-keystoneclient.

Change-Id: I3bc2e617b97822158ebfa39c021233557282e479
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Sync py3kcompat from oslo-incubator

Python3 reorganized the standard library and moved several
functions to different modules and combined modules. Six
provides a consistent interface to the module through
six.moves

However urllib/urlparse is not covered by six.moves so
py3kcompat adds python2/python3 compatibility layer for
urllib/urlparse.

Change-Id: I98d45a84e8c2dcd965a9e5cc08d7bb341eb08bfc
Signed-off-by: Chuck Short <chuck.short@canonical.com>
python3: Transition to mox3 instead of mox

In order to make the transition to mox free world,
mox needs to replaced with mox3 which is python3 compatible.

Change-Id: Id18928c7ac93b510a4867acb03896899fe1c13b0
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Merge "Move flake8 option from run_tests.sh to tox.ini"
Use OSLO jsonutils instead of json module

For most things there is very little difference, but as we have a
jsonutils module we should probably be using it.

Change-Id: I406ea81bb56ad90cc9ff9b8b58b0d35b694dc802
Support older token formats for projects in accessinfo

Older token formats get decoded as a v2 token so we should support
reading project information from these tokens.

Change-Id: I31473a00b294bd0d7b535cfab8d2eaf09db97ff5
Add domain attributes to accessinfo

user_domain_id and project_domain_id are already available, so simply
add an equivalent user_domain_name and project_domain_name if available.

The use of 'default' for v2 tokens is inspired from the default behaviour of
similar functions and what is used in auth_token middleware.

Change-Id: Ia9b345529072ab893d04c7a38fb7ba3acdc28227