summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Martinelli <stevemar@ca.ibm.com>2014-10-14 17:49:17 -0400
committerSteve Martinelli <stevemar@ca.ibm.com>2014-10-15 04:25:50 +0000
commit802301ca1763043bf699a52043504ab71a4dbb3b (patch)
treeca19bdc3eec296eda4721f92946525edc71856fb
parent89dc951f7d5a603f0c34b7c2cb9f7d26d73d9916 (diff)
downloadpython-keystoneclient-802301ca1763043bf699a52043504ab71a4dbb3b.tar.gz
Use oslo.utils and oslo.serialization
Left timeutils and strutils in openstack/common since they are used in openstack/common/apiclient and memorycache. Change-Id: Idb5f09c159d907dfba84cd1f7501f650318af7d9
-rw-r--r--keystoneclient/access.py3
-rw-r--r--keystoneclient/adapter.py3
-rw-r--r--keystoneclient/contrib/revoke/model.py2
-rw-r--r--keystoneclient/fixture/discovery.py3
-rw-r--r--keystoneclient/fixture/v2.py3
-rw-r--r--keystoneclient/fixture/v3.py3
-rw-r--r--keystoneclient/httpclient.py2
-rw-r--r--keystoneclient/middleware/auth_token.py4
-rw-r--r--keystoneclient/middleware/s3_token.py3
-rw-r--r--keystoneclient/openstack/common/jsonutils.py202
-rw-r--r--keystoneclient/session.py4
-rw-r--r--keystoneclient/shell.py4
-rw-r--r--keystoneclient/tests/auth/test_identity_common.py2
-rw-r--r--keystoneclient/tests/client_fixtures.py4
-rw-r--r--keystoneclient/tests/generic/test_client.py3
-rw-r--r--keystoneclient/tests/test_auth_token_middleware.py12
-rw-r--r--keystoneclient/tests/test_discovery.py2
-rw-r--r--keystoneclient/tests/test_keyring.py2
-rw-r--r--keystoneclient/tests/test_s3_token_middleware.py2
-rw-r--r--keystoneclient/tests/test_session.py2
-rw-r--r--keystoneclient/tests/utils.py3
-rw-r--r--keystoneclient/tests/v2_0/test_access.py2
-rw-r--r--keystoneclient/tests/v2_0/test_auth.py5
-rw-r--r--keystoneclient/tests/v3/test_access.py3
-rw-r--r--keystoneclient/tests/v3/test_auth.py3
-rw-r--r--keystoneclient/tests/v3/test_oauth1.py2
-rw-r--r--keystoneclient/tests/v3/test_trusts.py3
-rw-r--r--keystoneclient/utils.py6
-rwxr-xr-xkeystoneclient/v2_0/shell.py2
-rw-r--r--keystoneclient/v3/client.py3
-rw-r--r--keystoneclient/v3/contrib/trusts.py3
-rw-r--r--openstack-common.conf3
-rw-r--r--requirements.txt2
33 files changed, 56 insertions, 249 deletions
diff --git a/keystoneclient/access.py b/keystoneclient/access.py
index 1f2affa..80c6d98 100644
--- a/keystoneclient/access.py
+++ b/keystoneclient/access.py
@@ -17,7 +17,8 @@
import datetime
-from keystoneclient.openstack.common import timeutils
+from oslo.utils import timeutils
+
from keystoneclient import service_catalog
diff --git a/keystoneclient/adapter.py b/keystoneclient/adapter.py
index 3d65d78..68919b7 100644
--- a/keystoneclient/adapter.py
+++ b/keystoneclient/adapter.py
@@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from keystoneclient.openstack.common import jsonutils
+from oslo.serialization import jsonutils
+
from keystoneclient import utils
diff --git a/keystoneclient/contrib/revoke/model.py b/keystoneclient/contrib/revoke/model.py
index 2fc405c..60085ba 100644
--- a/keystoneclient/contrib/revoke/model.py
+++ b/keystoneclient/contrib/revoke/model.py
@@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-from keystoneclient.openstack.common import timeutils
+from oslo.utils import timeutils
# The set of attributes common between the RevokeEvent
# and the dictionaries created from the token Data.
diff --git a/keystoneclient/fixture/discovery.py b/keystoneclient/fixture/discovery.py
index 94cfe11..c7edf15 100644
--- a/keystoneclient/fixture/discovery.py
+++ b/keystoneclient/fixture/discovery.py
@@ -12,7 +12,8 @@
import datetime
-from keystoneclient.openstack.common import timeutils
+from oslo.utils import timeutils
+
from keystoneclient import utils
__all__ = ['DiscoveryList',
diff --git a/keystoneclient/fixture/v2.py b/keystoneclient/fixture/v2.py
index 467ad4c..3a107f4 100644
--- a/keystoneclient/fixture/v2.py
+++ b/keystoneclient/fixture/v2.py
@@ -13,8 +13,9 @@
import datetime
import uuid
+from oslo.utils import timeutils
+
from keystoneclient.fixture import exception
-from keystoneclient.openstack.common import timeutils
class _Service(dict):
diff --git a/keystoneclient/fixture/v3.py b/keystoneclient/fixture/v3.py
index e40b314..4f0d581 100644
--- a/keystoneclient/fixture/v3.py
+++ b/keystoneclient/fixture/v3.py
@@ -13,8 +13,9 @@
import datetime
import uuid
+from oslo.utils import timeutils
+
from keystoneclient.fixture import exception
-from keystoneclient.openstack.common import timeutils
class _Service(dict):
diff --git a/keystoneclient/httpclient.py b/keystoneclient/httpclient.py
index ce49dc4..d69bac3 100644
--- a/keystoneclient/httpclient.py
+++ b/keystoneclient/httpclient.py
@@ -21,6 +21,7 @@ OpenStack Client interface. Handles the REST calls and responses.
import logging
+from oslo.serialization import jsonutils
import pkg_resources
import requests
from six.moves.urllib import parse as urlparse
@@ -54,7 +55,6 @@ from keystoneclient import access
from keystoneclient.auth import base
from keystoneclient import baseclient
from keystoneclient import exceptions
-from keystoneclient.openstack.common import jsonutils
from keystoneclient import session as client_session
from keystoneclient import utils
diff --git a/keystoneclient/middleware/auth_token.py b/keystoneclient/middleware/auth_token.py
index 64a4a98..c1e3de7 100644
--- a/keystoneclient/middleware/auth_token.py
+++ b/keystoneclient/middleware/auth_token.py
@@ -155,6 +155,8 @@ import time
import netaddr
from oslo.config import cfg
+from oslo.serialization import jsonutils
+from oslo.utils import timeutils
import requests
import six
from six.moves import urllib
@@ -163,9 +165,7 @@ from keystoneclient import access
from keystoneclient.common import cms
from keystoneclient import exceptions
from keystoneclient.middleware import memcache_crypt
-from keystoneclient.openstack.common import jsonutils
from keystoneclient.openstack.common import memorycache
-from keystoneclient.openstack.common import timeutils
# alternative middleware configuration in the main application's
diff --git a/keystoneclient/middleware/s3_token.py b/keystoneclient/middleware/s3_token.py
index 50d0f1c..b27b9ce 100644
--- a/keystoneclient/middleware/s3_token.py
+++ b/keystoneclient/middleware/s3_token.py
@@ -33,13 +33,12 @@ This WSGI component:
import logging
+from oslo.serialization import jsonutils
import requests
import six
from six.moves import urllib
import webob
-from keystoneclient.openstack.common import jsonutils
-
PROTOCOL_NAME = 'S3 Token Authentication'
diff --git a/keystoneclient/openstack/common/jsonutils.py b/keystoneclient/openstack/common/jsonutils.py
deleted file mode 100644
index 3252588..0000000
--- a/keystoneclient/openstack/common/jsonutils.py
+++ /dev/null
@@ -1,202 +0,0 @@
-# Copyright 2010 United States Government as represented by the
-# Administrator of the National Aeronautics and Space Administration.
-# Copyright 2011 Justin Santa Barbara
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-'''
-JSON related utilities.
-
-This module provides a few things:
-
- 1) A handy function for getting an object down to something that can be
- JSON serialized. See to_primitive().
-
- 2) Wrappers around loads() and dumps(). The dumps() wrapper will
- automatically use to_primitive() for you if needed.
-
- 3) This sets up anyjson to use the loads() and dumps() wrappers if anyjson
- is available.
-'''
-
-
-import codecs
-import datetime
-import functools
-import inspect
-import itertools
-import sys
-
-is_simplejson = False
-if sys.version_info < (2, 7):
- # On Python <= 2.6, json module is not C boosted, so try to use
- # simplejson module if available
- try:
- import simplejson as json
- # NOTE(mriedem): Make sure we have a new enough version of simplejson
- # to support the namedobject_as_tuple argument. This can be removed
- # in the Kilo release when python 2.6 support is dropped.
- if 'namedtuple_as_object' in inspect.getargspec(json.dumps).args:
- is_simplejson = True
- else:
- import json
- except ImportError:
- import json
-else:
- import json
-
-import six
-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")
-
-_nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod,
- inspect.isfunction, inspect.isgeneratorfunction,
- inspect.isgenerator, inspect.istraceback, inspect.isframe,
- inspect.iscode, inspect.isbuiltin, inspect.isroutine,
- inspect.isabstract]
-
-_simple_types = (six.string_types + six.integer_types
- + (type(None), bool, float))
-
-
-def to_primitive(value, convert_instances=False, convert_datetime=True,
- level=0, max_depth=3):
- """Convert a complex object into primitives.
-
- Handy for JSON serialization. We can optionally handle instances,
- but since this is a recursive function, we could have cyclical
- data structures.
-
- To handle cyclical data structures we could track the actual objects
- visited in a set, but not all objects are hashable. Instead we just
- track the depth of the object inspections and don't go too deep.
-
- Therefore, convert_instances=True is lossy ... be aware.
-
- """
- # handle obvious types first - order of basic types determined by running
- # full tests on nova project, resulting in the following counts:
- # 572754 <type 'NoneType'>
- # 460353 <type 'int'>
- # 379632 <type 'unicode'>
- # 274610 <type 'str'>
- # 199918 <type 'dict'>
- # 114200 <type 'datetime.datetime'>
- # 51817 <type 'bool'>
- # 26164 <type 'list'>
- # 6491 <type 'float'>
- # 283 <type 'tuple'>
- # 19 <type 'long'>
- if isinstance(value, _simple_types):
- return value
-
- if isinstance(value, datetime.datetime):
- if convert_datetime:
- return timeutils.strtime(value)
- else:
- return value
-
- # value of itertools.count doesn't get caught by nasty_type_tests
- # and results in infinite loop when list(value) is called.
- if type(value) == itertools.count:
- return six.text_type(value)
-
- # FIXME(vish): Workaround for LP bug 852095. Without this workaround,
- # tests that raise an exception in a mocked method that
- # has a @wrap_exception with a notifier will fail. If
- # we up the dependency to 0.5.4 (when it is released) we
- # can remove this workaround.
- if getattr(value, '__module__', None) == 'mox':
- return 'mock'
-
- if level > max_depth:
- return '?'
-
- # The try block may not be necessary after the class check above,
- # but just in case ...
- try:
- recursive = functools.partial(to_primitive,
- convert_instances=convert_instances,
- convert_datetime=convert_datetime,
- level=level,
- max_depth=max_depth)
- if isinstance(value, dict):
- return dict((k, recursive(v)) for k, v in six.iteritems(value))
- elif isinstance(value, (list, tuple)):
- return [recursive(lv) for lv in value]
-
- # It's not clear why xmlrpclib created their own DateTime type, but
- # for our purposes, make it a datetime type which is explicitly
- # handled
- if isinstance(value, xmlrpclib.DateTime):
- value = datetime.datetime(*tuple(value.timetuple())[:6])
-
- if convert_datetime and isinstance(value, datetime.datetime):
- return timeutils.strtime(value)
- elif isinstance(value, gettextutils.Message):
- return value.data
- elif hasattr(value, 'iteritems'):
- return recursive(dict(value.iteritems()), level=level + 1)
- elif hasattr(value, '__iter__'):
- return recursive(list(value))
- elif convert_instances and hasattr(value, '__dict__'):
- # Likely an instance of something. Watch for cycles.
- # Ignore class member vars.
- return recursive(value.__dict__, level=level + 1)
- elif netaddr and isinstance(value, netaddr.IPAddress):
- return six.text_type(value)
- else:
- if any(test(value) for test in _nasty_type_tests):
- return six.text_type(value)
- return value
- except TypeError:
- # Class objects are tricky since they may define something like
- # __iter__ defined but it isn't callable as list().
- return six.text_type(value)
-
-
-def dumps(value, default=to_primitive, **kwargs):
- if is_simplejson:
- kwargs['namedtuple_as_object'] = False
- return json.dumps(value, default=default, **kwargs)
-
-
-def dump(obj, fp, *args, **kwargs):
- if is_simplejson:
- kwargs['namedtuple_as_object'] = False
- return json.dump(obj, fp, *args, **kwargs)
-
-
-def loads(s, encoding='utf-8', **kwargs):
- return json.loads(strutils.safe_decode(s, encoding), **kwargs)
-
-
-def load(fp, encoding='utf-8', **kwargs):
- return json.load(codecs.getreader(encoding)(fp), **kwargs)
-
-
-try:
- import anyjson
-except ImportError:
- pass
-else:
- anyjson._modules.append((__name__, 'dumps', TypeError,
- 'loads', ValueError, 'load'))
- anyjson.force_implementation(__name__)
diff --git a/keystoneclient/session.py b/keystoneclient/session.py
index 577c2bf..aab90f9 100644
--- a/keystoneclient/session.py
+++ b/keystoneclient/session.py
@@ -18,13 +18,13 @@ import os
import time
from oslo.config import cfg
+from oslo.serialization import jsonutils
+from oslo.utils import importutils
import requests
import six
from six.moves import urllib
from keystoneclient import exceptions
-from keystoneclient.openstack.common import importutils
-from keystoneclient.openstack.common import jsonutils
from keystoneclient import utils
osprofiler_web = importutils.try_import("osprofiler.web")
diff --git a/keystoneclient/shell.py b/keystoneclient/shell.py
index ad8d127..be7330c 100644
--- a/keystoneclient/shell.py
+++ b/keystoneclient/shell.py
@@ -30,6 +30,7 @@ import logging
import os
import sys
+from oslo.utils import encodeutils
import six
import keystoneclient
@@ -37,7 +38,6 @@ from keystoneclient import access
from keystoneclient.contrib.bootstrap import shell as shell_bootstrap
from keystoneclient import exceptions as exc
from keystoneclient.generic import shell as shell_generic
-from keystoneclient.openstack.common import strutils
from keystoneclient import session
from keystoneclient import utils
from keystoneclient.v2_0 import shell as shell_v2_0
@@ -463,7 +463,7 @@ def main():
OpenStackIdentityShell().main(sys.argv[1:])
except Exception as e:
- print(strutils.safe_encode(six.text_type(e)), file=sys.stderr)
+ print(encodeutils.safe_encode(six.text_type(e)), file=sys.stderr)
sys.exit(1)
diff --git a/keystoneclient/tests/auth/test_identity_common.py b/keystoneclient/tests/auth/test_identity_common.py
index 9a369f7..4a0cf57 100644
--- a/keystoneclient/tests/auth/test_identity_common.py
+++ b/keystoneclient/tests/auth/test_identity_common.py
@@ -14,6 +14,7 @@ import abc
import datetime
import uuid
+from oslo.utils import timeutils
import six
from keystoneclient import access
@@ -21,7 +22,6 @@ from keystoneclient.auth import base
from keystoneclient.auth.identity import v2
from keystoneclient.auth.identity import v3
from keystoneclient import fixture
-from keystoneclient.openstack.common import timeutils
from keystoneclient import session
from keystoneclient.tests import utils
diff --git a/keystoneclient/tests/client_fixtures.py b/keystoneclient/tests/client_fixtures.py
index d58deb2..cadae11 100644
--- a/keystoneclient/tests/client_fixtures.py
+++ b/keystoneclient/tests/client_fixtures.py
@@ -15,12 +15,12 @@
import os
import fixtures
+from oslo.serialization import jsonutils
+from oslo.utils import timeutils
import six
import testresources
from keystoneclient.common import cms
-from keystoneclient.openstack.common import jsonutils
-from keystoneclient.openstack.common import timeutils
from keystoneclient import utils
diff --git a/keystoneclient/tests/generic/test_client.py b/keystoneclient/tests/generic/test_client.py
index fc5816b..0f25f41 100644
--- a/keystoneclient/tests/generic/test_client.py
+++ b/keystoneclient/tests/generic/test_client.py
@@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo.serialization import jsonutils
+
from keystoneclient.generic import client
-from keystoneclient.openstack.common import jsonutils
from keystoneclient.tests import utils
BASE_HOST = 'http://keystone.example.com'
diff --git a/keystoneclient/tests/test_auth_token_middleware.py b/keystoneclient/tests/test_auth_token_middleware.py
index 3c42db3..ac4c1f3 100644
--- a/keystoneclient/tests/test_auth_token_middleware.py
+++ b/keystoneclient/tests/test_auth_token_middleware.py
@@ -25,6 +25,8 @@ import uuid
import fixtures
import iso8601
import mock
+from oslo.serialization import jsonutils
+from oslo.utils import timeutils
from requests_mock.contrib import fixture as mock_fixture
from six.moves.urllib import parse as urlparse
import testresources
@@ -37,9 +39,7 @@ from keystoneclient.common import cms
from keystoneclient import exceptions
from keystoneclient import fixture
from keystoneclient.middleware import auth_token
-from keystoneclient.openstack.common import jsonutils
from keystoneclient.openstack.common import memorycache
-from keystoneclient.openstack.common import timeutils
from keystoneclient.tests import client_fixtures
from keystoneclient.tests import utils
@@ -1759,7 +1759,7 @@ class TokenExpirationTest(BaseAuthTokenMiddlewareTest):
auth_token.confirm_token_not_expired,
data)
- @mock.patch('keystoneclient.openstack.common.timeutils.utcnow')
+ @mock.patch('oslo.utils.timeutils.utcnow')
def test_v2_token_with_timezone_offset_not_expired(self, mock_utcnow):
current_time = timeutils.parse_isotime('2000-01-01T00:01:10.000123Z')
current_time = timeutils.normalize_time(current_time)
@@ -1770,7 +1770,7 @@ class TokenExpirationTest(BaseAuthTokenMiddlewareTest):
actual_expires = auth_token.confirm_token_not_expired(data)
self.assertEqual(actual_expires, expected_expires)
- @mock.patch('keystoneclient.openstack.common.timeutils.utcnow')
+ @mock.patch('oslo.utils.timeutils.utcnow')
def test_v2_token_with_timezone_offset_expired(self, mock_utcnow):
current_time = timeutils.parse_isotime('2000-01-01T00:01:10.000123Z')
current_time = timeutils.normalize_time(current_time)
@@ -1794,7 +1794,7 @@ class TokenExpirationTest(BaseAuthTokenMiddlewareTest):
auth_token.confirm_token_not_expired,
data)
- @mock.patch('keystoneclient.openstack.common.timeutils.utcnow')
+ @mock.patch('oslo.utils.timeutils.utcnow')
def test_v3_token_with_timezone_offset_not_expired(self, mock_utcnow):
current_time = timeutils.parse_isotime('2000-01-01T00:01:10.000123Z')
current_time = timeutils.normalize_time(current_time)
@@ -1806,7 +1806,7 @@ class TokenExpirationTest(BaseAuthTokenMiddlewareTest):
actual_expires = auth_token.confirm_token_not_expired(data)
self.assertEqual(actual_expires, expected_expires)
- @mock.patch('keystoneclient.openstack.common.timeutils.utcnow')
+ @mock.patch('oslo.utils.timeutils.utcnow')
def test_v3_token_with_timezone_offset_expired(self, mock_utcnow):
current_time = timeutils.parse_isotime('2000-01-01T00:01:10.000123Z')
current_time = timeutils.normalize_time(current_time)
diff --git a/keystoneclient/tests/test_discovery.py b/keystoneclient/tests/test_discovery.py
index 811e65c..a999a19 100644
--- a/keystoneclient/tests/test_discovery.py
+++ b/keystoneclient/tests/test_discovery.py
@@ -13,6 +13,7 @@
import re
import uuid
+from oslo.serialization import jsonutils
import six
from testtools import matchers
@@ -22,7 +23,6 @@ from keystoneclient import client
from keystoneclient import discover
from keystoneclient import exceptions
from keystoneclient import fixture
-from keystoneclient.openstack.common import jsonutils
from keystoneclient import session
from keystoneclient.tests import utils
from keystoneclient.v2_0 import client as v2_client
diff --git a/keystoneclient/tests/test_keyring.py b/keystoneclient/tests/test_keyring.py
index 0ad0587..4bdf731 100644
--- a/keystoneclient/tests/test_keyring.py
+++ b/keystoneclient/tests/test_keyring.py
@@ -13,10 +13,10 @@
import datetime
import mock
+from oslo.utils import timeutils
from keystoneclient import access
from keystoneclient import httpclient
-from keystoneclient.openstack.common import timeutils
from keystoneclient.tests import utils
from keystoneclient.tests.v2_0 import client_fixtures
diff --git a/keystoneclient/tests/test_s3_token_middleware.py b/keystoneclient/tests/test_s3_token_middleware.py
index 0233e8b..ab77b79 100644
--- a/keystoneclient/tests/test_s3_token_middleware.py
+++ b/keystoneclient/tests/test_s3_token_middleware.py
@@ -13,13 +13,13 @@
# under the License.
import mock
+from oslo.serialization import jsonutils
import requests
import six
import testtools
import webob
from keystoneclient.middleware import s3_token
-from keystoneclient.openstack.common import jsonutils
from keystoneclient.tests import utils
diff --git a/keystoneclient/tests/test_session.py b/keystoneclient/tests/test_session.py
index 99c9e6e..6a9d408 100644
--- a/keystoneclient/tests/test_session.py
+++ b/keystoneclient/tests/test_session.py
@@ -17,6 +17,7 @@ import uuid
import mock
from oslo.config import cfg
from oslo.config import fixture as config
+from oslo.serialization import jsonutils
import requests
import six
from testtools import matchers
@@ -24,7 +25,6 @@ from testtools import matchers
from keystoneclient import adapter
from keystoneclient.auth import base
from keystoneclient import exceptions
-from keystoneclient.openstack.common import jsonutils
from keystoneclient import session as client_session
from keystoneclient.tests import utils
diff --git a/keystoneclient/tests/utils.py b/keystoneclient/tests/utils.py
index 4465835..a6f06c5 100644
--- a/keystoneclient/tests/utils.py
+++ b/keystoneclient/tests/utils.py
@@ -18,14 +18,13 @@ import uuid
import fixtures
import mock
from mox3 import mox
+from oslo.serialization import jsonutils
import requests
from requests_mock.contrib import fixture
import six
from six.moves.urllib import parse as urlparse
import testtools
-from keystoneclient.openstack.common import jsonutils
-
class TestCase(testtools.TestCase):
diff --git a/keystoneclient/tests/v2_0/test_access.py b/keystoneclient/tests/v2_0/test_access.py
index f384473..1cd926a 100644
--- a/keystoneclient/tests/v2_0/test_access.py
+++ b/keystoneclient/tests/v2_0/test_access.py
@@ -13,11 +13,11 @@
import datetime
import uuid
+from oslo.utils import timeutils
import testresources
from keystoneclient import access
from keystoneclient import fixture
-from keystoneclient.openstack.common import timeutils
from keystoneclient.tests import client_fixtures as token_data
from keystoneclient.tests.v2_0 import client_fixtures
from keystoneclient.tests.v2_0 import utils
diff --git a/keystoneclient/tests/v2_0/test_auth.py b/keystoneclient/tests/v2_0/test_auth.py
index cdf05f4..fd9ffc3 100644
--- a/keystoneclient/tests/v2_0/test_auth.py
+++ b/keystoneclient/tests/v2_0/test_auth.py
@@ -13,9 +13,10 @@
import copy
import datetime
+from oslo.serialization import jsonutils
+from oslo.utils import timeutils
+
from keystoneclient import exceptions
-from keystoneclient.openstack.common import jsonutils
-from keystoneclient.openstack.common import timeutils
from keystoneclient.tests.v2_0 import utils
from keystoneclient.v2_0 import client
diff --git a/keystoneclient/tests/v3/test_access.py b/keystoneclient/tests/v3/test_access.py
index df2566d..0f0b0e2 100644
--- a/keystoneclient/tests/v3/test_access.py
+++ b/keystoneclient/tests/v3/test_access.py
@@ -13,9 +13,10 @@
import datetime
import uuid
+from oslo.utils import timeutils
+
from keystoneclient import access
from keystoneclient import fixture
-from keystoneclient.openstack.common import timeutils
from keystoneclient.tests.v3 import client_fixtures
from keystoneclient.tests.v3 import utils
diff --git a/keystoneclient/tests/v3/test_auth.py b/keystoneclient/tests/v3/test_auth.py
index fb079b6..14a762f 100644
--- a/keystoneclient/tests/v3/test_auth.py
+++ b/keystoneclient/tests/v3/test_auth.py
@@ -10,8 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo.serialization import jsonutils
+
from keystoneclient import exceptions
-from keystoneclient.openstack.common import jsonutils
from keystoneclient.tests.v3 import utils
from keystoneclient.v3 import client
diff --git a/keystoneclient/tests/v3/test_oauth1.py b/keystoneclient/tests/v3/test_oauth1.py
index 0dc9c2a..d12ffdd 100644
--- a/keystoneclient/tests/v3/test_oauth1.py
+++ b/keystoneclient/tests/v3/test_oauth1.py
@@ -14,11 +14,11 @@
import uuid
import mock
+from oslo.utils import timeutils
import six
from six.moves.urllib import parse as urlparse
from testtools import matchers
-from keystoneclient.openstack.common import timeutils
from keystoneclient import session
from keystoneclient.tests.v3 import client_fixtures
from keystoneclient.tests.v3 import utils
diff --git a/keystoneclient/tests/v3/test_trusts.py b/keystoneclient/tests/v3/test_trusts.py
index 15e9348..0b8028f 100644
--- a/keystoneclient/tests/v3/test_trusts.py
+++ b/keystoneclient/tests/v3/test_trusts.py
@@ -13,8 +13,9 @@
import uuid
+from oslo.utils import timeutils
+
from keystoneclient import exceptions
-from keystoneclient.openstack.common import timeutils
from keystoneclient.tests.v3 import utils
from keystoneclient.v3.contrib import trusts
diff --git a/keystoneclient/utils.py b/keystoneclient/utils.py
index d3342f4..436b2f6 100644
--- a/keystoneclient/utils.py
+++ b/keystoneclient/utils.py
@@ -17,11 +17,11 @@ import inspect
import logging
import sys
+from oslo.utils import encodeutils
import prettytable
import six
from keystoneclient import exceptions
-from keystoneclient.openstack.common import strutils
logger = logging.getLogger(__name__)
@@ -61,7 +61,7 @@ def print_list(objs, fields, formatters={}, order_by=None):
if order_by is None:
order_by = fields[0]
- encoded = strutils.safe_encode(pt.get_string(sortby=order_by))
+ encoded = encodeutils.safe_encode(pt.get_string(sortby=order_by))
if six.PY3:
encoded = encoded.decode()
print(encoded)
@@ -88,7 +88,7 @@ def print_dict(d, wrap=0):
value = ''
value = _word_wrap(value, max_length=wrap)
pt.add_row([prop, value])
- encoded = strutils.safe_encode(pt.get_string(sortby='Property'))
+ encoded = encodeutils.safe_encode(pt.get_string(sortby='Property'))
if six.PY3:
encoded = encoded.decode()
print(encoded)
diff --git a/keystoneclient/v2_0/shell.py b/keystoneclient/v2_0/shell.py
index 5d8d265..976fb1e 100755
--- a/keystoneclient/v2_0/shell.py
+++ b/keystoneclient/v2_0/shell.py
@@ -26,9 +26,9 @@ import argparse
import getpass
import sys
+from oslo.utils import strutils
import six
-from keystoneclient.openstack.common import strutils
from keystoneclient import utils
from keystoneclient.v2_0 import client
diff --git a/keystoneclient/v3/client.py b/keystoneclient/v3/client.py
index a271db3..1967e8e 100644
--- a/keystoneclient/v3/client.py
+++ b/keystoneclient/v3/client.py
@@ -15,10 +15,11 @@
import logging
+from oslo.serialization import jsonutils
+
from keystoneclient.auth.identity import v3 as v3_auth
from keystoneclient import exceptions
from keystoneclient import httpclient
-from keystoneclient.openstack.common import jsonutils
from keystoneclient.v3.contrib import endpoint_filter
from keystoneclient.v3.contrib import endpoint_policy
from keystoneclient.v3.contrib import federation
diff --git a/keystoneclient/v3/contrib/trusts.py b/keystoneclient/v3/contrib/trusts.py
index ed199e6..70e9d8e 100644
--- a/keystoneclient/v3/contrib/trusts.py
+++ b/keystoneclient/v3/contrib/trusts.py
@@ -10,9 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo.utils import timeutils
+
from keystoneclient import base
from keystoneclient import exceptions
-from keystoneclient.openstack.common import timeutils
class Trust(base.Resource):
diff --git a/openstack-common.conf b/openstack-common.conf
index 586aac3..10f7b9b 100644
--- a/openstack-common.conf
+++ b/openstack-common.conf
@@ -3,10 +3,7 @@
# The list of modules to copy from oslo-incubator
module=apiclient
module=install_venv_common
-module=jsonutils
module=memorycache
-module=strutils
-module=timeutils
# The base module to hold the copy of openstack.common
base=keystoneclient
diff --git a/requirements.txt b/requirements.txt
index 5a08b75..a163e05 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -9,6 +9,8 @@ Babel>=1.3
iso8601>=0.1.9
netaddr>=0.7.12
oslo.config>=1.4.0 # Apache-2.0
+oslo.serialization>=1.0.0 # Apache-2.0
+oslo.utils>=1.0.0 # Apache-2.0
PrettyTable>=0.7,<0.8
requests>=1.2.1,!=2.4.0
six>=1.7.0