Switch to oslo.utils

Change-Id: I74979d8f75b099858314a30c98bb252c379e0304
This commit is contained in:
Julien Danjou 2014-09-30 11:46:52 +02:00
parent a114803233
commit 6519cf36fd
34 changed files with 45 additions and 43 deletions

View File

@ -15,12 +15,12 @@
# under the License. # under the License.
import mock import mock
from oslo.utils import importutils
from heat.common import exception from heat.common import exception
from heat.common import template_format from heat.common import template_format
from heat.engine import resource from heat.engine import resource
from heat.engine import scheduler from heat.engine import scheduler
from heat.openstack.common.importutils import try_import
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase
from heat.tests import utils from heat.tests import utils
@ -29,7 +29,7 @@ from testtools import skipIf
from ..resources import docker_container # noqa from ..resources import docker_container # noqa
from .fake_docker_client import FakeDockerClient # noqa from .fake_docker_client import FakeDockerClient # noqa
docker = try_import('docker') docker = importutils.try_import('docker')
template = ''' template = '''

View File

@ -17,10 +17,10 @@
from keystoneclient.v2_0 import client as kc from keystoneclient.v2_0 import client as kc
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import importutils
from heat.common import exception from heat.common import exception
from heat.common.i18n import _ from heat.common.i18n import _
from heat.openstack.common import importutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
LOG = logging.getLogger('heat.common.keystoneclient') LOG = logging.getLogger('heat.common.keystoneclient')

View File

@ -16,9 +16,9 @@
import mock import mock
import mox import mox
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import importutils
from heat.common import exception from heat.common import exception
from heat.openstack.common import importutils
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase
from heat.tests import utils from heat.tests import utils

View File

@ -14,6 +14,7 @@
import hashlib import hashlib
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import importutils
import requests import requests
import webob import webob
@ -23,7 +24,6 @@ from heat.common.i18n import _
from heat.common.i18n import _LE from heat.common.i18n import _LE
from heat.common.i18n import _LI from heat.common.i18n import _LI
from heat.common import wsgi from heat.common import wsgi
from heat.openstack.common import importutils
from heat.openstack.common import jsonutils as json from heat.openstack.common import jsonutils as json
from heat.openstack.common import log as logging from heat.openstack.common import log as logging

View File

@ -15,11 +15,11 @@
# limitations under the License. # limitations under the License.
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import importutils
from webob.exc import HTTPBadRequest from webob.exc import HTTPBadRequest
from webob.exc import HTTPUnauthorized from webob.exc import HTTPUnauthorized
from heat.common import wsgi from heat.common import wsgi
from heat.openstack.common import importutils
class AuthUrlFilter(wsgi.Middleware): class AuthUrlFilter(wsgi.Middleware):

View File

@ -11,13 +11,14 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.utils import importutils
from heat.common import exception from heat.common import exception
from heat.common import policy from heat.common import policy
from heat.common import wsgi from heat.common import wsgi
from heat.db import api as db_api from heat.db import api as db_api
from heat.engine import clients from heat.engine import clients
from heat.openstack.common import context from heat.openstack.common import context
from heat.openstack.common import importutils
from heat.openstack.common import local from heat.openstack.common import local
from heat.openstack.common.middleware import request_id from heat.openstack.common.middleware import request_id

View File

@ -16,6 +16,7 @@
from collections import namedtuple from collections import namedtuple
import copy import copy
import json import json
from oslo.utils import importutils
import uuid import uuid
from keystoneclient.auth.identity import v3 as kc_auth_v3 from keystoneclient.auth.identity import v3 as kc_auth_v3
@ -29,7 +30,6 @@ from heat.common import exception
from heat.common.i18n import _ from heat.common.i18n import _
from heat.common.i18n import _LE from heat.common.i18n import _LE
from heat.common.i18n import _LW from heat.common.i18n import _LW
from heat.openstack.common import importutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
LOG = logging.getLogger('heat.common.keystoneclient') LOG = logging.getLogger('heat.common.keystoneclient')

View File

@ -14,10 +14,9 @@
import collections import collections
import re import re
from oslo.utils import encodeutils
from six.moves.urllib import parse as urlparse from six.moves.urllib import parse as urlparse
from heat.openstack.common import strutils
class HeatIdentifier(collections.Mapping): class HeatIdentifier(collections.Mapping):
@ -116,7 +115,7 @@ class HeatIdentifier(collections.Mapping):
stacks/<stack_name>/<stack_id><path> stacks/<stack_name>/<stack_id><path>
""" """
return 'stacks/%s%s' % (self.stack_path(), return 'stacks/%s%s' % (self.stack_path(),
urlparse.quote(strutils.safe_encode( urlparse.quote(encodeutils.safe_encode(
self.path))) self.path)))
def stack_path(self): def stack_path(self):

View File

@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.utils import strutils
from heat.openstack.common.gettextutils import _ from heat.openstack.common.gettextutils import _
from heat.openstack.common import strutils
def extract_bool(subject): def extract_bool(subject):

View File

@ -34,6 +34,7 @@ from eventlet.green import ssl
import eventlet.greenio import eventlet.greenio
import eventlet.wsgi import eventlet.wsgi
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import importutils
from paste import deploy from paste import deploy
import routes import routes
import routes.middleware import routes.middleware
@ -45,7 +46,6 @@ from heat.api.aws import exception as aws_exception
from heat.common import exception from heat.common import exception
from heat.common import serializers from heat.common import serializers
from heat.openstack.common import gettextutils from heat.openstack.common import gettextutils
from heat.openstack.common import importutils
URL_LENGTH_LIMIT = 50000 URL_LENGTH_LIMIT = 50000

View File

@ -15,10 +15,9 @@ import itertools
import uuid import uuid
import migrate.changeset.constraint as constraint import migrate.changeset.constraint as constraint
from oslo.utils import timeutils
import sqlalchemy import sqlalchemy
from heat.openstack.common import timeutils
def upgrade(migrate_engine): def upgrade(migrate_engine):
if migrate_engine.name == 'sqlite': if migrate_engine.name == 'sqlite':

View File

@ -17,6 +17,7 @@ SQLAlchemy models for heat data.
import uuid import uuid
from oslo.db.sqlalchemy import models from oslo.db.sqlalchemy import models
from oslo.utils import timeutils
import six import six
import sqlalchemy import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
@ -25,7 +26,6 @@ from sqlalchemy.orm import relationship
from sqlalchemy.orm.session import Session from sqlalchemy.orm.session import Session
from heat.db.sqlalchemy.types import Json from heat.db.sqlalchemy.types import Json
from heat.openstack.common import timeutils
BASE = declarative_base() BASE = declarative_base()

View File

@ -11,12 +11,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.utils import timeutils
from heat.common.i18n import _ from heat.common.i18n import _
from heat.common import param_utils from heat.common import param_utils
from heat.common import template_format from heat.common import template_format
from heat.engine import constraints as constr from heat.engine import constraints as constr
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
from heat.openstack.common import timeutils
from heat.rpc import api from heat.rpc import api
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -12,11 +12,11 @@
# under the License. # under the License.
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import importutils
from stevedore import extension from stevedore import extension
import warnings import warnings
from heat.common.i18n import _ from heat.common.i18n import _
from heat.openstack.common import importutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -15,11 +15,11 @@ import collections
import numbers import numbers
import re import re
from oslo.utils import strutils
import six import six
from heat.common import exception from heat.common import exception
from heat.engine import resources from heat.engine import resources
from heat.openstack.common import strutils
class Schema(collections.Mapping): class Schema(collections.Mapping):

View File

@ -15,11 +15,12 @@ import collections
import itertools import itertools
import json import json
from oslo.utils import encodeutils
from oslo.utils import strutils
import six import six
from heat.common import exception from heat.common import exception
from heat.engine import constraints as constr from heat.engine import constraints as constr
from heat.openstack.common import strutils
PARAMETER_KEYS = ( PARAMETER_KEYS = (
@ -270,7 +271,7 @@ class Parameter(object):
if self.hidden(): if self.hidden():
return '******' return '******'
else: else:
return strutils.safe_encode(six.text_type(value)) return encodeutils.safe_encode(six.text_type(value))
class NumberParam(Parameter): class NumberParam(Parameter):
@ -394,7 +395,7 @@ class JsonParam(Parameter):
def __str__(self): def __str__(self):
if self.hidden(): if self.hidden():
return super(JsonParam, self).__str__() return super(JsonParam, self).__str__()
return strutils.safe_decode(json.dumps(self.value())) return encodeutils.safe_decode(json.dumps(self.value()))
def _validate(self, val, context): def _validate(self, val, context):
val = self.parse(val) val = self.parse(val)

View File

@ -15,6 +15,7 @@ import base64
import contextlib import contextlib
from datetime import datetime from datetime import datetime
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import excutils
import six import six
import warnings import warnings
@ -33,7 +34,6 @@ from heat.engine import resources
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import support from heat.engine import support
from heat.openstack.common import excutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
cfg.CONF.import_opt('action_retry_limit', 'heat.common.config') cfg.CONF.import_opt('action_retry_limit', 'heat.common.config')

View File

@ -14,6 +14,7 @@
import copy import copy
import math import math
from oslo.utils import excutils
import six import six
from heat.common import environment_format from heat.common import environment_format
@ -27,7 +28,6 @@ from heat.engine import properties
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import stack_resource from heat.engine import stack_resource
from heat.openstack.common import excutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
from heat.scaling import cooldown from heat.scaling import cooldown
from heat.scaling import template from heat.scaling import template

View File

@ -11,6 +11,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.utils import excutils
from heat.common import exception from heat.common import exception
from heat.common.i18n import _ from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
@ -18,7 +20,6 @@ from heat.engine import constraints
from heat.engine import properties from heat.engine import properties
from heat.engine import resource from heat.engine import resource
from heat.engine.resources.vpc import VPC from heat.engine.resources.vpc import VPC
from heat.openstack.common import excutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -11,11 +11,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo.utils import excutils
from heat.common.i18n import _ from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import properties from heat.engine import properties
from heat.engine import resource from heat.engine import resource
from heat.openstack.common import excutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -18,10 +18,10 @@ from time import time as wallclock
import types import types
import eventlet import eventlet
from oslo.utils import excutils
import six import six
from heat.common.i18n import _ from heat.common.i18n import _
from heat.openstack.common import excutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -19,6 +19,7 @@ import os
import eventlet import eventlet
from oslo.config import cfg from oslo.config import cfg
from oslo import messaging from oslo import messaging
from oslo.utils import timeutils
import requests import requests
import six import six
import warnings import warnings
@ -47,7 +48,6 @@ from heat.openstack.common import jsonutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
from heat.openstack.common import service from heat.openstack.common import service
from heat.openstack.common import threadgroup from heat.openstack.common import threadgroup
from heat.openstack.common import timeutils
from heat.openstack.common import uuidutils from heat.openstack.common import uuidutils
from heat.rpc import api as rpc_api from heat.rpc import api as rpc_api

View File

@ -18,6 +18,7 @@ import re
import warnings import warnings
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import encodeutils
import six import six
from heat.common import context as common_context from heat.common import context as common_context
@ -38,7 +39,6 @@ from heat.engine import scheduler
from heat.engine.template import Template from heat.engine.template import Template
from heat.engine import update from heat.engine import update
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
from heat.openstack.common import strutils
from heat.rpc import api as rpc_api from heat.rpc import api as rpc_api
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -458,7 +458,7 @@ class Stack(collections.Mapping):
raise ex raise ex
except Exception as ex: except Exception as ex:
LOG.exception(ex) LOG.exception(ex)
raise StackValidationFailed(message=strutils.safe_decode( raise StackValidationFailed(message=encodeutils.safe_decode(
six.text_type(ex))) six.text_type(ex)))
if result: if result:
raise StackValidationFailed(message=result) raise StackValidationFailed(message=result)

View File

@ -16,12 +16,12 @@ import uuid
from oslo.config import cfg from oslo.config import cfg
from oslo import messaging from oslo import messaging
from oslo.utils import excutils
from heat.common import exception from heat.common import exception
from heat.common.i18n import _ from heat.common.i18n import _
from heat.common import messaging as rpc_messaging from heat.common import messaging as rpc_messaging
from heat.db import api as db_api from heat.db import api as db_api
from heat.openstack.common import excutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
cfg.CONF.import_opt('engine_life_check_timeout', 'heat.common.config') cfg.CONF.import_opt('engine_life_check_timeout', 'heat.common.config')

View File

@ -14,13 +14,14 @@
import datetime import datetime
from oslo.utils import timeutils
from heat.common import exception from heat.common import exception
from heat.common.i18n import _ from heat.common.i18n import _
from heat.db import api as db_api from heat.db import api as db_api
from heat.engine import parser from heat.engine import parser
from heat.engine import timestamp from heat.engine import timestamp
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
from heat.openstack.common import timeutils
from heat.rpc import api as rpc_api from heat.rpc import api as rpc_api
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from heat.openstack.common import timeutils from oslo.utils import timeutils
class CooldownMixin(object): class CooldownMixin(object):

View File

@ -16,12 +16,12 @@ import json
import six import six
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import importutils
import requests import requests
from heat.api.aws import ec2token from heat.api.aws import ec2token
from heat.api.aws import exception from heat.api.aws import exception
from heat.common.wsgi import Request from heat.common.wsgi import Request
from heat.openstack.common import importutils
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase

View File

@ -17,6 +17,7 @@ import datetime
import mock import mock
import mox import mox
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import timeutils
import six import six
from heat.common import exception from heat.common import exception
@ -31,7 +32,6 @@ from heat.engine.resources import loadbalancer
from heat.engine.resources.neutron import loadbalancer as neutron_lb from heat.engine.resources.neutron import loadbalancer as neutron_lb
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.engine import scheduler from heat.engine import scheduler
from heat.openstack.common import timeutils
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase
from heat.tests import utils from heat.tests import utils

View File

@ -15,6 +15,7 @@ import datetime
import itertools import itertools
from oslo.config import cfg from oslo.config import cfg
from oslo.utils import timeutils
from heat.common import exception from heat.common import exception
from heat.common import short_id from heat.common import short_id
@ -23,7 +24,6 @@ from heat.engine import resource
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import stack_resource from heat.engine import stack_resource
from heat.openstack.common import timeutils
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase
from heat.tests import generic_resource from heat.tests import generic_resource
from heat.tests import utils from heat.tests import utils

View File

@ -12,6 +12,7 @@
# under the License. # under the License.
import mock import mock
from oslo.utils import timeutils
from heat.common import exception from heat.common import exception
from heat.common import template_format from heat.common import template_format
@ -28,7 +29,6 @@ from heat.engine.resources import user
from heat.engine.resources import wait_condition as waitc from heat.engine.resources import wait_condition as waitc
from heat.engine import signal_responder as signal from heat.engine import signal_responder as signal
from heat.engine import stack_resource from heat.engine import stack_resource
from heat.openstack.common import timeutils
from heat.tests import common from heat.tests import common
from heat.tests import generic_resource from heat.tests import generic_resource
# reuse the same template than autoscaling tests # reuse the same template than autoscaling tests

View File

@ -21,6 +21,7 @@ import uuid
import fixtures import fixtures
import mock import mock
import mox import mox
from oslo.utils import timeutils
from heat.common import context from heat.common import context
from heat.common import exception from heat.common import exception
@ -33,7 +34,6 @@ from heat.engine import parser
from heat.engine.resource import Resource from heat.engine.resource import Resource
from heat.engine.resources import instance as instances from heat.engine.resources import instance as instances
from heat.engine import scheduler from heat.engine import scheduler
from heat.openstack.common import timeutils
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase
from heat.tests import utils from heat.tests import utils
from heat.tests.v1_1 import fakes from heat.tests.v1_1 import fakes

View File

@ -15,13 +15,13 @@
import datetime import datetime
import mox import mox
from oslo.utils import timeutils
from heat.common import exception from heat.common import exception
from heat.db import api as db_api from heat.db import api as db_api
from heat.engine import parser from heat.engine import parser
from heat.engine import template from heat.engine import template
from heat.engine import watchrule from heat.engine import watchrule
from heat.openstack.common import timeutils
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase
from heat.tests import utils from heat.tests import utils

View File

@ -5,9 +5,7 @@ module=config
module=context module=context
module=crypto module=crypto
module=eventlet_backdoor module=eventlet_backdoor
module=excutils
module=gettextutils module=gettextutils
module=importutils
module=jsonutils module=jsonutils
module=local module=local
module=log module=log
@ -15,9 +13,7 @@ module=loopingcall
module=policy module=policy
module=processutils module=processutils
module=service module=service
module=strutils
module=threadgroup module=threadgroup
module=timeutils
module=uuidutils module=uuidutils
module=versionutils module=versionutils
module=middleware.base module=middleware.base

View File

@ -17,6 +17,7 @@ oslo.config>=1.4.0 # Apache-2.0
oslo.db>=1.0.0 # Apache-2.0 oslo.db>=1.0.0 # Apache-2.0
oslo.i18n>=1.0.0 # Apache-2.0 oslo.i18n>=1.0.0 # Apache-2.0
oslo.messaging>=1.4.0 oslo.messaging>=1.4.0
oslo.utils>=1.0.0 # Apache-2.0
PasteDeploy>=1.5.0 PasteDeploy>=1.5.0
posix_ipc posix_ipc
pycrypto>=2.6 pycrypto>=2.6