Handle obsolete and unused oslo modules

The python-troveclient module still had references to strutils, and
gettextutils which are now obsolete.

Change-Id: Ia54a565c00966b0a1cb5f18c6e17e1237b2bfee6
Partial-Bug: #1380789
This commit is contained in:
Amrith Kumar
2014-12-09 17:29:24 -05:00
parent 96e44b5a9b
commit dca7bfe1e6
7 changed files with 58 additions and 14 deletions

View File

@@ -2,8 +2,6 @@
# The list of modules to copy from openstack-common # The list of modules to copy from openstack-common
module=apiclient module=apiclient
module=strutils
module=importutils
module=install_venv_common module=install_venv_common
# The base module to hold the copy of openstack.common # The base module to hold the copy of openstack.common

View File

@@ -6,6 +6,7 @@ argparse
PrettyTable>=0.7,<0.8 PrettyTable>=0.7,<0.8
requests>=2.2.0,!=2.4.0 requests>=2.2.0,!=2.4.0
simplejson>=2.2.0 simplejson>=2.2.0
oslo.utils>=1.2.0
python-keystoneclient>=0.11.1 python-keystoneclient>=0.11.1
Babel>=1.3 Babel>=1.3
six>=1.7.0 six>=1.7.0

View File

@@ -25,9 +25,9 @@ import logging
import requests import requests
from keystoneclient import adapter from keystoneclient import adapter
from oslo.utils import importutils
from troveclient.openstack.common.apiclient import client from troveclient.openstack.common.apiclient import client
from troveclient.openstack.common.apiclient import exceptions from troveclient.openstack.common.apiclient import exceptions
from troveclient.openstack.common import importutils
from troveclient import service_catalog from troveclient import service_catalog
try: try:

View File

@@ -14,7 +14,7 @@
import os import os
from troveclient.openstack.common import strutils from oslo.utils import strutils
class HookableMixin(object): class HookableMixin(object):

41
troveclient/i18n.py Normal file
View File

@@ -0,0 +1,41 @@
# Copyright 2014 Tesora, Inc.
# 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.
"""oslo.i18n integration module.
See http://docs.openstack.org/developer/oslo.i18n/usage.html
"""
import oslo.i18n
# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
# application name when this module is synced into the separate
# repository. It is OK to have more than one translation function
# using the same domain, since there will still only be one message
# catalog.
_translators = oslo.i18n.TranslatorFactory(domain='python-troveclient')
# The primary translation function using the well-known name "_"
_ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical

View File

@@ -38,15 +38,17 @@ from keystoneclient.auth.identity.generic import token
from keystoneclient.auth.identity import v3 as identity from keystoneclient.auth.identity import v3 as identity
from keystoneclient import session as ks_session from keystoneclient import session as ks_session
from oslo.utils import encodeutils
from oslo.utils import importutils
import troveclient import troveclient
import troveclient.auth_plugin import troveclient.auth_plugin
from troveclient import client from troveclient import client
import troveclient.extension import troveclient.extension
from troveclient.i18n import _ # noqa
from troveclient.openstack.common.apiclient import exceptions as exc from troveclient.openstack.common.apiclient import exceptions as exc
from troveclient.openstack.common import gettextutils as gtu
from troveclient.openstack.common.gettextutils import _ # noqa
from troveclient.openstack.common import importutils
from troveclient.openstack.common import strutils
from troveclient import utils from troveclient import utils
from troveclient.v1 import shell as shell_v1 from troveclient.v1 import shell as shell_v1
@@ -620,7 +622,7 @@ class OpenStackHelpFormatter(argparse.HelpFormatter):
'trove create <name> <flavor_id> --databases <db_name>' 'trove create <name> <flavor_id> --databases <db_name>'
""" """
if prefix is None: if prefix is None:
prefix = gtu._('usage: ') prefix = _('usage: ')
# if usage is specified, use that # if usage is specified, use that
if usage is not None: if usage is not None:
@@ -723,7 +725,7 @@ def main():
if sys.version_info >= (3, 0): if sys.version_info >= (3, 0):
OpenStackTroveShell().main(sys.argv[1:]) OpenStackTroveShell().main(sys.argv[1:])
else: else:
OpenStackTroveShell().main(map(strutils.safe_decode, OpenStackTroveShell().main(map(encodeutils.safe_decode,
sys.argv[1:])) sys.argv[1:]))
except KeyboardInterrupt: except KeyboardInterrupt:
print("... terminating trove client", file=sys.stderr) print("... terminating trove client", file=sys.stderr)
@@ -733,7 +735,7 @@ def main():
message = six.text_type(e) message = six.text_type(e)
if not isinstance(message, six.string_types): if not isinstance(message, six.string_types):
message = str(message) message = str(message)
print("ERROR: %s" % strutils.safe_encode(message), file=sys.stderr) print("ERROR: %s" % encodeutils.safe_encode(message), file=sys.stderr)
sys.exit(1) sys.exit(1)

View File

@@ -24,8 +24,10 @@ import uuid
import prettytable import prettytable
import six import six
from oslo.utils import encodeutils
from oslo.utils import strutils
from troveclient.openstack.common.apiclient import exceptions from troveclient.openstack.common.apiclient import exceptions
from troveclient.openstack.common import strutils
def arg(*args, **kwargs): def arg(*args, **kwargs):
@@ -136,7 +138,7 @@ def _print(pt, order):
if sys.version_info >= (3, 0): if sys.version_info >= (3, 0):
print(pt.get_string(sortby=order)) print(pt.get_string(sortby=order))
else: else:
print(strutils.safe_encode(pt.get_string(sortby=order))) print(encodeutils.safe_encode(pt.get_string(sortby=order)))
def print_list(objs, fields, formatters={}, order_by=None, obj_is_dict=False, def print_list(objs, fields, formatters={}, order_by=None, obj_is_dict=False,
@@ -209,7 +211,7 @@ def find_resource(manager, name_or_id):
if isinstance(name_or_id, int) or name_or_id.isdigit(): if isinstance(name_or_id, int) or name_or_id.isdigit():
name_or_id = int(name_or_id) name_or_id = int(name_or_id)
elif sys.version_info <= (3, 0): elif sys.version_info <= (3, 0):
name_or_id = strutils.safe_decode(name_or_id) name_or_id = encodeutils.safe_decode(name_or_id)
try: try:
return manager.get(name_or_id) return manager.get(name_or_id)