Apply six for metaclass

The way to using metaclass has changed in Python3.

Python 2.7 way:

class Foo(object):
  __metaclass__ = FooMeta

Python 3 way:

class Foo(object, metaclass=FooMeta):
  ...

The six.add_metaclass() decorator allows us to use one syntax that
works for both Python 2.7 and Python 3.

Change-Id: I08703a8b2927f45f4705fe085368d1ebd78b02fa
Closes-Bug: #1236648
Remove SERVICE_TOKEN and SERVICE_ENDPOINT env vars

From the code itself:

 deprecated command line options for essex compatibility. To be
  removed in Grizzly release cycle.

so this patch removes these deprecated env vars that have been
moved into the OS_* namespace since Folsom, and updates the tests
that probably should have been using the non-deprecated option
anyway :)

The fact these are still in there are causing some confusion,
we actually had a bug report over in docs claiming OS_SERVICE_TOKEN
should be replaced with SERVICE_TOKEN!

Change-Id: I205748be225dbacc3a528724cf3722d8bf7f8d9f
Avoid returning stale token via auth_token property

The auth_ref token should take precedence over the user provided
token, since any call to authenticate() will update the auth_ref,
rendering the auth_token_from_user stale.

Change-Id: Ibc86dca840f4b8dd23856735616ee48a7b397fcd
Closes-Bug: #1244675
Migrate the keystone.common.cms to keystoneclient

- Add checking the openssl return code 2, related to following review

  https://review.openstack.org/#/c/22716/

- Add support set subprocess to the cms, when we already know which
  subprocess to use.

Closes-Bug: #1142574
Change-Id: I3f86e6ca8bb7738f57051ce7f0f5662b20e7a22b
Remove unused simplejson requirement

Closes-Bug: 1245556

Change-Id: I84107c7102d6f6a8ac264629ba52616531ef7288
python3: Work around httpretty issue

Currently running tox.ini with py33 installation
fails because of a failure to read a unicode file
while installing httpretty.

Closes-Bug: #1241560

Change-Id: I6012c4fcca0d0354f0c1bdf4797f6e7409f7bf1c
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Improved error message on connection failure

Added message from thrown error to message generated when httpclient connection fails

Closes-Bug: 1248257

Change-Id: Id47092f5775b97e8423e18c294f4e04872aa0b08
Convert revocation list file last modified to UTC

On a restart of a service using auth_token middleware, the last modified
time of the revocation list file is checked to decide whether to get the
fresh list from keystone. In server timezones that are ahead of UTC,
this compares a local time with UTC. This means whenever a service is
restarted it doesn't update the revocation list for the length of the
timezone offset from UTC.

This change converts the last modified time to UTC when it's first
read, so the comparison is valid.

Closes-bug: 1204000
Change-Id: I623b6273beb56f8da2a8649a10a64318da8cd6bc
Add --insecure to curl output if required

When the --insecure option is given, the curl command did not have
certificate verification turned off.

Partial-Bug: #1249891
Change-Id: Ia4f21d03f060bac0db51a79b89b0246b2ee3d041
Fix curl debug output for requests with a body

Rather than output the request body as a separate line, make it part of
the example curl command using the -d option.

Partial-Bug: #1249891
Change-Id: Ie3fe4535f554333c67244a13c5698c025f000e7e
Quote URL in curl output to handle query params

Copy and pasting the generated curl output into a shell doesn't
work when the URL includes an ampersand, as the URL isn't quoted.

Closes-Bug: #1249891
Change-Id: Ic3d7682a2c034e89c3367c858ea33510f8cbc7d4
Make HACKING.rst DRYer and turn into rst file

Rename HACKING to HACKING.rst since it is a rst file and
reference the OpenStack hacking guide and remove
duplicated entries.

Change-Id: I9994594c7f8cb0f011d949b273bea08c68985e16
Merge "Apply six for metaclass"
Update tox.ini to usedevelop

The 0.8 hacking tests were failing because it fails to open the
sample files during import. Setting usedevelop=True in the tox.ini
makes the tests run in the right directory.

Change-Id: I7b8f531f669e38e1b009a50d2ed9e9c98cf82e53
Fix python3 incompatible use of urlparse

Use six to make it work. While we're not yet able to gate
keystoneclient on py33, we still need keystoneclient to work when
keystoneclient is included in other libraries' test suites. This was
discovered while working on python3 for python-tuskarclient.

Note that together with I65c28896d1551fd537dd7774e87bc479a477a7ab
keystoneclient can be used safely in python-tuskarclient's py33 tests.

Closes-bug: #1239802

Change-Id: Ie6d31dc5fae7e63bb31a5192fa6765fe35dd026a
Merge "python3: Work around httpretty issue"
Add testresources test requirement

testresources wasn't a test requirement, so it couldn't be used
in test code.

Change-Id: I278e56f5158800e7873ad03a9d6a3db2ea8bad7c
Remove service type restriction from keystone client help text

The current output of "keystone help service-create" implies that the
type is restricted to certain values.  This commit updates the help
text to make it more clear that the value isn't validated.

Closes bug 1248658
Closes bug 1211292

Change-Id: Ice4bf0da135d371ab5b6339f7baac7309e9c40ce
Update the management url for every fetched token

management_url was originally set once and never changed so that when
specifying an endpoint it wasn't later overridden by the service
catalog. This behaviour would prevent the management_url from being
updated when the client was reauthenticated.

Change-Id: I2fa41e2ae1b853bbb254698cf94b9314eb0f0903
Closes-bug: 1252927
"publicurl" should be required on endpoint-create

publicurl field is required and cannot be empty when create a endpoint in
keystone server.So the "--publicurl " also should set as mandatory in
keystoneclient.

Change-Id: Ia397c79a28dd3a6ddef141df0f7df30cc0bf7b6c
Closes-Bug: #1246335