From 25cf51f43737f03efb9972e1b8f04a2e74e14f2a Mon Sep 17 00:00:00 2001 From: Amrith Kumar Date: Thu, 11 Dec 2014 11:25:54 -0500 Subject: [PATCH] Eliminate redundant modules from oslo-incubator This change is part of a multi-part change set to handle obsolete and graduated oslo modules. This commit cleans up openstack-common.conf which has unnecessary entries for middleware and fileutils that are not required in trove. Also, trove acquired a trove/openstack/common/utils.py which had two routines that were long ago moved into strutils (now oslo.utils). The sole remaining reference to that source file has been updated to reflect this. This change is based on https://review.openstack.org/#/c/141081/ Change-Id: I279161ac7b321f306df180a2df20f64e869866b0 Partial-Bug: #1380789 --- openstack-common.conf | 4 --- trove/common/utils.py | 7 ++-- trove/openstack/common/utils.py | 59 --------------------------------- 3 files changed, 4 insertions(+), 66 deletions(-) delete mode 100644 trove/openstack/common/utils.py diff --git a/openstack-common.conf b/openstack-common.conf index 22dea12055..5b93450004 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -3,19 +3,15 @@ # The list of modules to copy from oslo-incubator module=context module=eventlet_backdoor -module=fileutils module=local module=log module=loopingcall -module=middleware module=notifier module=pastedeploy module=periodic_task -module=policy module=rpc module=service module=threadgroup -module=utils module=versionutils # The base module to hold the copy of openstack.common diff --git a/trove/common/utils.py b/trove/common/utils.py index 43c8ccb67e..c023577b27 100644 --- a/trove/common/utils.py +++ b/trove/common/utils.py @@ -28,21 +28,22 @@ from passlib import utils as passlib_utils from oslo.utils import importutils from oslo.utils import timeutils +from oslo.utils import strutils from oslo_concurrency import processutils from trove.common import cfg from trove.common import exception +from trove.common.i18n import _ from trove.openstack.common import log as logging from trove.openstack.common import loopingcall -from trove.openstack.common import utils as openstack_utils -from trove.common.i18n import _ + CONF = cfg.CONF LOG = logging.getLogger(__name__) import_class = importutils.import_class import_object = importutils.import_object import_module = importutils.import_module -bool_from_string = openstack_utils.bool_from_string +bool_from_string = strutils.bool_from_string execute = processutils.execute isotime = timeutils.isotime diff --git a/trove/openstack/common/utils.py b/trove/openstack/common/utils.py deleted file mode 100644 index 05f0e9f7be..0000000000 --- a/trove/openstack/common/utils.py +++ /dev/null @@ -1,59 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2011 OpenStack LLC. -# 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. - -""" -System-level utilities and helper functions. -""" - -import logging - -LOG = logging.getLogger(__name__) - - -def int_from_bool_as_string(subject): - """ - Interpret a string as a boolean and return either 1 or 0. - - Any string value in: - - ('True', 'true', 'On', 'on', '1') - - is interpreted as a boolean True. - - Useful for JSON-decoded stuff and config file parsing - """ - return bool_from_string(subject) and 1 or 0 - - -def bool_from_string(subject): - """ - Interpret a string as a boolean. - - Any string value in: - - ('True', 'true', 'On', 'on', 'Yes', 'yes', '1') - - is interpreted as a boolean True. - - Useful for JSON-decoded stuff and config file parsing - """ - if isinstance(subject, bool): - return subject - if isinstance(subject, basestring): - if subject.strip().lower() in ('true', 'on', 'yes', '1'): - return True - return False