Tests use cleanUp rather than tearDown

The tests were putting clean-up code in tearDown. Using tearDown
causes problems with developing and testing because if there's an
exception raised in setUp then tearDown is not called and this
can affect other tests and make it hard to figure out what the
problem was.

Also, this should make it easier to switch to using fixtures since
fixtures use cleanUp.

Change-Id: Ifc22dfd9012402c895a09534f4b1d9bd7a2ec931
refactor handling of extension list

Change-Id: I922c17523197497139da92d8be33dba10349a369
Remove support for old Swift memcache interface.

Since this has  been removed since a year, it's time to clean this up.

Change-Id: I6681a31f675f2178285dadea876af1fdb7a8a4c3
Provide a conversion function for creating session

Session.construct will create a session based upon the kwargs that used
to be passed to a client __init__ function. This will allow clients an
easy path to providing compatibility with deprecated arguments.

Make use of the function throughout discovery. Discovery was initially
released prior to the session object being completed and was therefore
handled with the same arguments as a client. Instead we should use a
session object so use the conversion function to convert those kwargs
into a session object if one is not provided.

Change-Id: I8dc1e0810ea6ebc6ea648ec37d7881825c566676
Merge "Tests use cleanUp rather than tearDown"
Use HTTPretty in S3 test code

Remove the httplib specific mocks that are used within the S3
middleware. This won't work when we convert S3 middleware to use the
requests library.

Change-Id: Iee5f3089286c980bef3a19dc9d5068399946e217
Related-Bug: #1275598
Create Authentication Plugins

Provides the framework for creating authentication plugins and using
them from a session object.

To allow this system to co-exist with the original client there is a bit
of a hack. The client object itself is now also an authentication
plugin, that supports the original client pattern. If a client is
created without a session object then that session object uses the
client as it's authentication plugin.

Change-Id: I682c8dcd3705148aaa804a91f4ed48a5b74bdc12
blueprint: auth-plugins
Sync apiclient from oslo

In the process of unification of the clients code we should
reuse common functionality from Oslo.

Hash of latest commit which affected apiclient in oslo at time of sync:
- be81d6ba70152e5cdd7e8e9d789b9733c6ff527f

Related to blueprint common-client-library-2

Change-Id: I93d5dae3a2ba124d6fba91f02c486dca25c5e09e
Python 3: make tests from v2_0/test_access.py pass

This fixes calls to the hash_signed_token() and cms_hash_token() functions, by
making sure they are given bytes.

Change-Id: I83ac48a845cd09150b01afad6f0549ee83c20ddd
Use requests library in S3 middleware

Convert the S3 token middleware to use the requests library. It does not
validate certificates as part of this patch to keep new functionality
isolated.

Change-Id: I0f26c80a969b919de80410af0a80920bd8493191
Closes-Bug: #1275598
Improve output of "keystone help discover"

The current output of "keystone help discover" is:

usage: keystone discover

Discover Keystone servers, supported API versions and extensions.  Usage:: $
keystone discover Keystone found at http://localhost:35357 - supports version
v1.0 (DEPRECATED) here http://localhost:35357/v1.0 - supports version v1.1
(CURRENT) here http://localhost:35357/v1.1 - supports version v2.0 (CURRENT)
here http://localhost:35357/v2.0 - and RAX-KSKEY: Rackspace API Key
Authentication Admin Extension - and RAX-KSGRP: Rackspace Keystone Group
Extensions

The reason is that our parser strips away all the line ends. Let's
rephrase the text so that it formats more nicely.

Now the output is:
Discover Keystone servers, supported API versions and extensions.

Change-Id: Ic9f9e3e407ae299eb091a0a7093c955dc6cab8f2
Python 3: call functions from memcache_crypt.py with bytes as input

These functions expect bytes as input, but in Python 3 they were given text
strings.

Change-Id: I39fa15b8d5d56dc536e0bd71a50cf27da3d03046
Merge "Python 3: make tests from v2_0/test_access.py pass"
Merge "Use requests library in S3 middleware"
Python3: webob.Response.body must be bytes

Remove duplicate assignement for 'resp.body'. Use bytes in Python3.

Change-Id: Ice1beb997ae401ebb87762e5499970409c63d801
Check for any monkeypatching

Checking oinly for monkeypatching of the ``os`` module is
insufficient.  A process might have chosen not to patch ``os`` but
still needs to use the eventlet version of Popen to deal with proper
forks.  This version checks if any modules have been monkeypatched
with the eventlet versions.

Closes-Bug: #1277231

Change-Id: Ia8d7150e9e7ced58132e8e90e7ad68fb3c7c3b9f
Merge "Check for any monkeypatching"
cms: Use universal_newlines=True in subprocess.Popen()

The Python documentation states that "the type of [the first argument of
subprocess.communicate()] must be bytes or, if universal_newlines was True, a
string"[1]. Currently, in Python 3, a text string is given to
subprocess.communicate(), even though the process was created with
universal_newlines=False (the default value).

Rather than converting strings to bytes (and the other way around) everywhere
in the code, just create the process with universal_newlines=True. The side
effect is that '\n', '\r\n' and '\r' will be recognized as ending lines[2],
which should not be an issue.

[1] http://docs.python.org/3/library/subprocess.html?highlight=popen#subprocess.Popen.communicate
[2] http://docs.python.org/3/glossary.html#term-universal-newlines

Change-Id: I668b187ba8ed00ad6d55ec487af623b79b21589d
Merge "Provide a conversion function for creating session"
Merge "Create Authentication Plugins"