python3: Refactor dict for python2/python3 compat

Python3 changed the behavior of dict.keys such that it is now
returns a dict_keys object, which is iterable but not indexable.
You can get the python2 result back with an explicit call to list.

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

Synce the changes of jsonutils from oslo, following fixes are synced:

Ia915f3175bee370d747e362cd9d35d8536c1b7b2
Id1aa7af26b0f5d929337cc373c6a4f802bba2cec
Ic94f238a5f92f28ae1b6154fb56f00c4c9fa3283
I8b246f20f9001379fcb5ca3a84aabee3847cb945

Most of them are py33 fixes, and keystoneclient is required by a dozen of
projects, we should update it to avoid py33 issue in dependent projects.

Closes-Bug #1239602

Change-Id: I65c28896d1551fd537dd7774e87bc479a477a7ab
Merge "Sync jsonutils from oslo"
Merge "python3: Refactor dict for python2/python3 compat"
Make ROOTDIR determination more robust

Remove unused CLIENTDIR and replace it with a TESTDIR
(pointing to rootdir/keystoneclient/tests) and use
normpath for determining the full path of rootdir.

This change is needed if keystoneclient/ is a symlink
and etc/ is in a different directory hierarchy.

Change-Id: Ice9165ef25ec0200ccfb50c2f2f3121a136652a2
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>
PEP 8 Public and internal interfaces

Define which interfaces are public and which are internal based
on PEP 8.

For reference, PEP 8 section is here:
http://www.python.org/dev/peps/pep-0008/#public-and-internal-interfaces

Change-Id: I14233796b7838b78fbd355014478f3e326542966
Merge "Make ROOTDIR determination more robust"
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"