Merge "Switch heat resources & db & tests to oslo.i18n"

This commit is contained in:
Jenkins 2014-09-19 04:23:49 +00:00 committed by Gerrit Code Review
commit 442e79b559
39 changed files with 52 additions and 48 deletions

View File

@ -16,10 +16,10 @@
import six import six
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.gettextutils import _
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,7 +19,7 @@ from keystoneclient.v2_0 import client as kc
from oslo.config import cfg from oslo.config import cfg
from heat.common import exception from heat.common import exception
from heat.openstack.common.gettextutils import _ from heat.common.i18n import _
from heat.openstack.common import importutils from heat.openstack.common import importutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging

View File

@ -11,9 +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 heat.common.i18n import _
from heat.engine import properties from heat.engine import properties
from heat.engine import resource from heat.engine import resource
from heat.openstack.common.gettextutils import _
class NovaFlavor(resource.Resource): class NovaFlavor(resource.Resource):

View File

@ -18,13 +18,13 @@ import urlparse
from oslo.config import cfg from oslo.config import cfg
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine.clients import client_plugin from heat.engine.clients import client_plugin
from heat.engine.clients.os import cinder from heat.engine.clients.os import cinder
from heat.engine.clients.os import glance from heat.engine.clients.os import glance
from heat.engine.clients.os import nova from heat.engine.clients.os import nova
from heat.engine.clients.os import trove from heat.engine.clients.os import trove
from heat.openstack.common.gettextutils import _
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
from glanceclient import client as gc from glanceclient import client as gc

View File

@ -14,10 +14,10 @@
"""Resources for Rackspace DNS.""" """Resources for Rackspace DNS."""
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import constraints 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.openstack.common.gettextutils import _
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
try: try:

View File

@ -17,6 +17,7 @@ import itertools
import six import six
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints from heat.engine import constraints
from heat.engine import function from heat.engine import function
@ -24,7 +25,6 @@ from heat.engine import properties
from heat.engine.properties import Properties from heat.engine.properties import Properties
from heat.engine import resource from heat.engine import resource
from heat.engine import scheduler from heat.engine import scheduler
from heat.openstack.common.gettextutils import _
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
try: try:

View File

@ -14,10 +14,10 @@
import copy import copy
from heat.common import exception from heat.common import exception
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.resources import server from heat.engine.resources import server
from heat.openstack.common.gettextutils import _
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
try: try:

View File

@ -14,11 +14,11 @@
import netaddr import netaddr
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints 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.openstack.common.gettextutils import _
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
try: try:

View File

@ -19,13 +19,13 @@ from docutils import nodes
import pydoc import pydoc
from sphinx.util.compat import Directive from sphinx.util.compat import Directive
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import environment from heat.engine import environment
from heat.engine import plugin_manager from heat.engine import plugin_manager
from heat.engine import properties from heat.engine import properties
from heat.engine import resources from heat.engine import resources
from heat.engine import support from heat.engine import support
from heat.openstack.common.gettextutils import _
global_env = environment.Environment({}, user_env=False) global_env = environment.Environment({}, user_env=False)

View File

@ -108,9 +108,9 @@ plug-in.
.. code-block:: python .. code-block:: python
from heat.common.i18n import _
from heat.engine import constraints from heat.engine import constraints
from heat.engine import properties from heat.engine import properties
from heat.openstack.common.gettextutils import _
nested_schema = { nested_schema = {
"foo": properties.Schema( "foo": properties.Schema(

View File

@ -14,7 +14,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 heat.openstack.common import gettextutils from oslo import i18n
gettextutils.enable_lazy() i18n.enable_lazy()
gettextutils.install('heat', lazy=True) # fixme(elynn): Since install() is deprecated, we should remove it in
# the future
i18n.install('heat')

View File

@ -25,10 +25,10 @@ from sqlalchemy.orm.session import Session
from heat.common import crypt from heat.common import crypt
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.db.sqlalchemy import filters as db_filters from heat.db.sqlalchemy import filters as db_filters
from heat.db.sqlalchemy import migration from heat.db.sqlalchemy import migration
from heat.db.sqlalchemy import models from heat.db.sqlalchemy import models
from heat.openstack.common.gettextutils import _
CONF = cfg.CONF CONF = cfg.CONF
CONF.import_opt('max_events_per_stack', 'heat.common.config') CONF.import_opt('max_events_per_stack', 'heat.common.config')

View File

@ -16,7 +16,7 @@ import uuid
from migrate.versioning import util as migrate_util from migrate.versioning import util as migrate_util
import sqlalchemy import sqlalchemy
from heat.openstack.common.gettextutils import _ from heat.common.i18n import _
def upgrade(migrate_engine): def upgrade(migrate_engine):

View File

@ -17,9 +17,9 @@ from migrate.versioning import util as migrate_util
import six import six
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker
from heat.common.i18n import _
from heat.db.sqlalchemy import models from heat.db.sqlalchemy import models
from heat.engine.hot.parameters import HOTParamSchema from heat.engine.hot.parameters import HOTParamSchema
from heat.openstack.common.gettextutils import _
def upgrade(migrate_engine): def upgrade(migrate_engine):

View File

@ -16,8 +16,8 @@ from migrate.versioning import util as migrate_util
import six import six
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker
from heat.common.i18n import _
from heat.db.sqlalchemy import models from heat.db.sqlalchemy import models
from heat.openstack.common.gettextutils import _
def upgrade(migrate_engine): def upgrade(migrate_engine):

View File

@ -16,8 +16,8 @@ import time
from migrate.versioning import util as migrate_util from migrate.versioning import util as migrate_util
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker
from heat.common.i18n import _
from heat.db.sqlalchemy import models from heat.db.sqlalchemy import models
from heat.openstack.common.gettextutils import _
def upgrade(migrate_engine): def upgrade(migrate_engine):

View File

@ -17,12 +17,14 @@ from __future__ import print_function
import sys import sys
from oslo.config import cfg from oslo.config import cfg
from oslo import i18n
from heat.db import migration from heat.db import migration
from heat.openstack.common import gettextutils
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
gettextutils.install('heat') # fixme(elynn): Since install() is deprecated, we should remove it in
# the future
i18n.install('heat')
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -12,13 +12,13 @@
# under the License. # under the License.
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints 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 excutils
from heat.openstack.common.gettextutils import _
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,10 +11,10 @@
# 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.common.i18n import _
from heat.engine import constraints 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.openstack.common.gettextutils import _
class GlanceImage(resource.Resource): class GlanceImage(resource.Resource):

View File

@ -17,6 +17,7 @@ from oslo.config import cfg
import six import six
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints from heat.engine import constraints
from heat.engine import properties from heat.engine import properties
@ -24,7 +25,6 @@ from heat.engine import resource
from heat.engine.resources import volume from heat.engine.resources import volume
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import signal_responder from heat.engine import signal_responder
from heat.openstack.common.gettextutils import _
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
cfg.CONF.import_opt('instance_user', 'heat.common.config') cfg.CONF.import_opt('instance_user', 'heat.common.config')

View File

@ -12,10 +12,10 @@
# under the License. # under the License.
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import properties from heat.engine import properties
from heat.engine import resource from heat.engine import resource
from heat.engine.resources import route_table from heat.engine.resources import route_table
from heat.openstack.common.gettextutils import _
class InternetGateway(resource.Resource): class InternetGateway(resource.Resource):

View File

@ -15,12 +15,12 @@ import os
from oslo.config import cfg from oslo.config import cfg
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.common import template_format from heat.common import template_format
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints from heat.engine import constraints
from heat.engine import properties from heat.engine import properties
from heat.engine import stack_resource from heat.engine import stack_resource
from heat.openstack.common.gettextutils import _
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,11 @@
# 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.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 excutils
from heat.openstack.common.gettextutils import _
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

@ -12,11 +12,11 @@
# under the License. # under the License.
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints 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.openstack.common.gettextutils import _
class KeyPair(resource.Resource): class KeyPair(resource.Resource):

View File

@ -10,10 +10,10 @@
# 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.common.i18n import _
from heat.engine import constraints 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.openstack.common.gettextutils import _
class ServerGroup(resource.Resource): class ServerGroup(resource.Resource):

View File

@ -27,8 +27,8 @@ from six.moves.urllib import parse as urlparse
import warnings import warnings
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import scheduler from heat.engine import scheduler
from heat.openstack.common.gettextutils import _
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

@ -12,11 +12,11 @@
# under the License. # under the License.
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints 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.openstack.common.gettextutils import _
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
from heat.openstack.common import uuidutils from heat.openstack.common import uuidutils

View File

@ -17,12 +17,12 @@ import string
from six.moves import xrange from six.moves import xrange
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints 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 import support from heat.engine import support
from heat.openstack.common.gettextutils import _
class RandomString(resource.Resource): class RandomString(resource.Resource):

View File

@ -15,12 +15,12 @@ import collections
import copy import copy
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints from heat.engine import constraints
from heat.engine import properties from heat.engine import properties
from heat.engine import stack_resource from heat.engine import stack_resource
from heat.engine import template from heat.engine import template
from heat.openstack.common.gettextutils import _
template_template = { template_template = {
"heat_template_version": "2013-05-23", "heat_template_version": "2013-05-23",

View File

@ -14,11 +14,11 @@
# limitations under the License. # limitations under the License.
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints 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.openstack.common.gettextutils import _
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

@ -14,10 +14,10 @@
# limitations under the License. # limitations under the License.
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import constraints 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.openstack.common.gettextutils import _
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

@ -17,6 +17,7 @@ import uuid
from oslo.config import cfg from oslo.config import cfg
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints from heat.engine import constraints
from heat.engine import properties from heat.engine import properties
@ -25,7 +26,6 @@ from heat.engine.resources.neutron import subnet
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import stack_user from heat.engine import stack_user
from heat.engine import support from heat.engine import support
from heat.openstack.common.gettextutils import _
from heat.openstack.common import jsonutils 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 uuidutils from heat.openstack.common import uuidutils

View File

@ -16,10 +16,10 @@ from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText from email.mime.text import MIMEText
import os import os
from heat.common.i18n import _
from heat.engine import constraints from heat.engine import constraints
from heat.engine import properties from heat.engine import properties
from heat.engine.resources.software_config import software_config from heat.engine.resources.software_config import software_config
from heat.openstack.common.gettextutils import _
class MultipartMime(software_config.SoftwareConfig): class MultipartMime(software_config.SoftwareConfig):

View File

@ -11,11 +11,11 @@
# 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.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine import constraints 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.openstack.common.gettextutils import _
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

@ -17,13 +17,13 @@ import urlparse
from swiftclient import client as swiftclient_client from swiftclient import client as swiftclient_client
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes from heat.engine import attributes
from heat.engine.clients.os import swift from heat.engine.clients.os import swift
from heat.engine import constraints 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 import scheduler from heat.engine import scheduler
from heat.openstack.common.gettextutils import _
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,18 +11,18 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
# See http://code.google.com/p/python-nose/issues/detail?id=373 from oslo import i18n
# The code below enables nosetests to work with i18n _() blocks
from heat.openstack.common import gettextutils
def fake_translate_msgid(msgid, domain, desired_locale=None): def fake_translate_msgid(msgid, domain, desired_locale=None):
return msgid return msgid
gettextutils.enable_lazy() i18n.enable_lazy()
gettextutils.install('heat', lazy=True) # fixme(elynn): Since install() is deprecated, we should remove it in
# the future
i18n.install('heat')
#To ensure messages don't really get translated while running tests. #To ensure messages don't really get translated while running tests.
#As there are lots of places where matching is expected when comparing #As there are lots of places where matching is expected when comparing
#exception message(translated) with raw message. #exception message(translated) with raw message.
gettextutils._translate_msgid = fake_translate_msgid i18n._translate_msgid = fake_translate_msgid

View File

@ -20,6 +20,7 @@ from oslo.config import cfg
import six import six
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.common import short_id from heat.common import short_id
from heat.common import timeutils from heat.common import timeutils
from heat.db import api as db_api from heat.db import api as db_api
@ -32,7 +33,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 template from heat.engine import template
from heat.openstack.common.gettextutils import _
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase
from heat.tests import generic_resource as generic_rsrc from heat.tests import generic_resource as generic_rsrc
from heat.tests import utils from heat.tests import utils

View File

@ -22,6 +22,7 @@ import mox
from novaclient import exceptions as nova_exceptions from novaclient import exceptions as nova_exceptions
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.common import template_format from heat.common import template_format
from heat.db import api as db_api from heat.db import api as db_api
from heat.engine.clients.os import glance from heat.engine.clients.os import glance
@ -34,7 +35,6 @@ from heat.engine import resource
from heat.engine.resources import server as servers from heat.engine.resources import server as servers
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import template from heat.engine import template
from heat.openstack.common.gettextutils import _
from heat.openstack.common import uuidutils from heat.openstack.common import uuidutils
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase
from heat.tests import fakes from heat.tests import fakes

View File

@ -18,11 +18,11 @@ import mock
import six import six
from heat.common import exception from heat.common import exception
from heat.common.i18n import _
from heat.engine import parser from heat.engine import parser
from heat.engine.resources.software_config import software_deployment as sd from heat.engine.resources.software_config import software_deployment as sd
from heat.engine import rsrc_defn from heat.engine import rsrc_defn
from heat.engine import template from heat.engine import template
from heat.openstack.common import gettextutils
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase
from heat.tests import utils from heat.tests import utils
@ -687,7 +687,7 @@ class SoftwareDeploymentTest(HeatTestCase):
}, args) }, args)
# Test bug 1332355, where details contains a translateable message # Test bug 1332355, where details contains a translateable message
details = {'failed': gettextutils.Message('need more memory.')} details = {'failed': _('need more memory.')}
self.deployment.handle_signal(details) self.deployment.handle_signal(details)
args = sd.update.call_args[1] args = sd.update.call_args[1]
self.assertEqual({ self.assertEqual({