From 54cc999a4def0bcf6faef4da9bc2f7caf131044f Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Tue, 27 May 2014 13:53:58 -0400 Subject: [PATCH] Sync with oslo-incubator caed79d This syncs python-keystoneclient with oslo-incubator commit hash caed79d8239679cb74476bb0d9e5011b4fcc39da First, remove the existing code to cleanup: $ rm -r keystoneclient/openstack/* Then, sync from oslo-incubator: $ python update.py ../python-keystoneclient Commits since last sync (2640847): ---------------------------------- 1173e46 Remove ValueError when accessing sys.modules 90ae24b Remove redundant default=None for config options 18f2bc1 Enforce unicode json output for jsonutils.load[s]() 4a777e5 Fix warnings in doc build for apiclient Related-Bug: #1315523 Closes-Bug: #1314129 Change-Id: Id53ea2d4828e81bc6270f186849f391e7bc73101 --- keystoneclient/openstack/common/apiclient/auth.py | 4 ++-- keystoneclient/openstack/common/apiclient/base.py | 4 ++-- keystoneclient/openstack/common/apiclient/client.py | 5 +++-- keystoneclient/openstack/common/importutils.py | 4 ++-- keystoneclient/openstack/common/jsonutils.py | 10 ++++++---- keystoneclient/openstack/common/memorycache.py | 1 - 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/keystoneclient/openstack/common/apiclient/auth.py b/keystoneclient/openstack/common/apiclient/auth.py index 68c764449..e68990d57 100644 --- a/keystoneclient/openstack/common/apiclient/auth.py +++ b/keystoneclient/openstack/common/apiclient/auth.py @@ -213,8 +213,8 @@ class BaseAuthPlugin(object): :type service_type: string :param endpoint_type: Type of endpoint. Possible values: public or publicURL, - internal or internalURL, - admin or adminURL + internal or internalURL, + admin or adminURL :type endpoint_type: string :returns: tuple of token and endpoint strings :raises: EndpointException diff --git a/keystoneclient/openstack/common/apiclient/base.py b/keystoneclient/openstack/common/apiclient/base.py index 2f9b7a4ab..d958ae173 100644 --- a/keystoneclient/openstack/common/apiclient/base.py +++ b/keystoneclient/openstack/common/apiclient/base.py @@ -75,8 +75,8 @@ class HookableMixin(object): :param cls: class that registers hooks :param hook_type: hook type, e.g., '__pre_parse_args__' - :param **args: args to be passed to every hook function - :param **kwargs: kwargs to be passed to every hook function + :param args: args to be passed to every hook function + :param kwargs: kwargs to be passed to every hook function """ hook_funcs = cls._hooks_map.get(hook_type) or [] for hook_func in hook_funcs: diff --git a/keystoneclient/openstack/common/apiclient/client.py b/keystoneclient/openstack/common/apiclient/client.py index 584b18724..ed0fbc8e6 100644 --- a/keystoneclient/openstack/common/apiclient/client.py +++ b/keystoneclient/openstack/common/apiclient/client.py @@ -47,6 +47,7 @@ class HTTPClient(object): """This client handles sending HTTP requests to OpenStack servers. Features: + - share authentication information between several clients to different services (e.g., for compute and image clients); - reissue authentication request for expired tokens; @@ -152,7 +153,7 @@ class HTTPClient(object): :param method: method of HTTP request :param url: URL of HTTP request :param kwargs: any other parameter that can be passed to -' requests.Session.request (such as `headers`) or `json` + requests.Session.request (such as `headers`) or `json` that will be encoded as JSON and used as `data` argument """ kwargs.setdefault("headers", kwargs.get("headers", {})) @@ -207,7 +208,7 @@ class HTTPClient(object): :param method: method of HTTP request :param url: URL of HTTP request :param kwargs: any other parameter that can be passed to -' `HTTPClient.request` + `HTTPClient.request` """ filter_args = { diff --git a/keystoneclient/openstack/common/importutils.py b/keystoneclient/openstack/common/importutils.py index b06fb7cfa..1261278ad 100644 --- a/keystoneclient/openstack/common/importutils.py +++ b/keystoneclient/openstack/common/importutils.py @@ -24,10 +24,10 @@ import traceback def import_class(import_str): """Returns a class from a string including module and class.""" mod_str, _sep, class_str = import_str.rpartition('.') + __import__(mod_str) try: - __import__(mod_str) return getattr(sys.modules[mod_str], class_str) - except (ValueError, AttributeError): + except AttributeError: raise ImportError('Class %s cannot be found (%s)' % (class_str, traceback.format_exception(*sys.exc_info()))) diff --git a/keystoneclient/openstack/common/jsonutils.py b/keystoneclient/openstack/common/jsonutils.py index 8e646a6ff..7302ac8c6 100644 --- a/keystoneclient/openstack/common/jsonutils.py +++ b/keystoneclient/openstack/common/jsonutils.py @@ -31,6 +31,7 @@ This module provides a few things: ''' +import codecs import datetime import functools import inspect @@ -52,6 +53,7 @@ import six.moves.xmlrpc_client as xmlrpclib from keystoneclient.openstack.common import gettextutils from keystoneclient.openstack.common import importutils +from keystoneclient.openstack.common import strutils from keystoneclient.openstack.common import timeutils netaddr = importutils.try_import("netaddr") @@ -166,12 +168,12 @@ def dumps(value, default=to_primitive, **kwargs): return json.dumps(value, default=default, **kwargs) -def loads(s): - return json.loads(s) +def loads(s, encoding='utf-8'): + return json.loads(strutils.safe_decode(s, encoding)) -def load(fp): - return json.load(fp) +def load(fp, encoding='utf-8'): + return json.load(codecs.getreader(encoding)(fp)) try: diff --git a/keystoneclient/openstack/common/memorycache.py b/keystoneclient/openstack/common/memorycache.py index c02ef8c93..a83363494 100644 --- a/keystoneclient/openstack/common/memorycache.py +++ b/keystoneclient/openstack/common/memorycache.py @@ -22,7 +22,6 @@ from keystoneclient.openstack.common import timeutils memcache_opts = [ cfg.ListOpt('memcached_servers', - default=None, help='Memcached servers or None for in process cache.'), ]