Add log translation marker

According to http://docs.openstack.org/developer/oslo.i18n/
guidelines.html#log-translation,log messages are recommended to use log
 translation marker.

Change-Id: Id1f2ef10eb65dcda6fa629d51a51870af2390548
This commit is contained in:
chenaidong1 2016-12-06 16:20:23 +08:00
parent b07473d388
commit 77fc44cdad
4 changed files with 19 additions and 13 deletions

View File

@ -21,7 +21,7 @@ import six
import tenacity import tenacity
from webob import response from webob import response
from murano.common.i18n import _LI, _LW from murano.common.i18n import _LI, _LW, _LE
from murano.common import auth_utils # noqa from murano.common import auth_utils # noqa
from murano.common import wsgi from murano.common import wsgi
from murano.db.services import cf_connections as db_cf from murano.db.services import cf_connections as db_cf
@ -304,8 +304,9 @@ def _get_muranoclient(token_id, req):
murano_url = CONF.murano.url or req.endpoints.get('murano') murano_url = CONF.murano.url or req.endpoints.get('murano')
if not murano_url: if not murano_url:
LOG.error('No murano url is specified and no "application-catalog" ' LOG.error(_LE('No murano url is specified and no '
'service is registered in keystone.') '"application-catalog" '
'service is registered in keystone.'))
return muranoclient.Client(1, murano_url, token=token_id, return muranoclient.Client(1, murano_url, token=token_id,
artifacts_client=artifacts_client) artifacts_client=artifacts_client)
@ -316,8 +317,8 @@ def _get_glareclient(token_id, req):
url = glare_settings.url or req.endpoints.get('glare') url = glare_settings.url or req.endpoints.get('glare')
if not url: if not url:
LOG.error('No glare url is specified and no "artifact" ' LOG.error(_LE('No glare url is specified and no "artifact" '
'service is registered in keystone.') 'service is registered in keystone.'))
return glare_client.Client( return glare_client.Client(
endpoint=url, token=token_id, endpoint=url, token=token_id,

View File

@ -18,7 +18,7 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from stevedore import dispatch from stevedore import dispatch
from murano.common.i18n import _LE, _LW from murano.common.i18n import _LE, _LW, _LI
CONF = cfg.CONF CONF = cfg.CONF
@ -28,7 +28,7 @@ NAMESPACE = 'io.murano.plugins.packages'
class PluginLoader(object): class PluginLoader(object):
def __init__(self): def __init__(self):
LOG.info('Loading package type plugins') LOG.info(_LI('Loading package type plugins'))
extension_manager = dispatch.EnabledExtensionManager( extension_manager = dispatch.EnabledExtensionManager(
NAMESPACE, NAMESPACE,
self._is_plugin_enabled, self._is_plugin_enabled,
@ -75,7 +75,7 @@ class PluginLoader(object):
else: else:
self._initialize_plugin(package_class) self._initialize_plugin(package_class)
self.formats.setdefault(name, {})[version] = package_class self.formats.setdefault(name, {})[version] = package_class
LOG.info('Plugin for "{0}" package type was loaded'.format( LOG.info(_LI('Plugin for "{0}" package type was loaded').format(
format_name)) format_name))
def get_package_handler(self, format_name): def get_package_handler(self, format_name):

View File

@ -32,6 +32,8 @@ from murano.dsl import virtual_exceptions
from murano.dsl import yaql_integration from murano.dsl import yaql_integration
from murano.common.i18n import _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
macros.register() macros.register()
virtual_exceptions.register() virtual_exceptions.register()
@ -137,8 +139,8 @@ class MuranoMethod(dsl_types.MuranoMethod, meta.MetaProvider):
if self._usage == dsl_types.MethodUsages.Action: if self._usage == dsl_types.MethodUsages.Action:
runtime_version = self.declaring_type.package.runtime_version runtime_version = self.declaring_type.package.runtime_version
if runtime_version > constants.RUNTIME_VERSION_1_3: if runtime_version > constants.RUNTIME_VERSION_1_3:
LOG.warning('"Usage: Action" is deprecated, ' LOG.warning(_LW('"Usage: Action" is deprecated, '
'use "Scope: Public" instead') 'use "Scope: Public" instead'))
if self._scope == dsl_types.MethodScopes.Session: if self._scope == dsl_types.MethodScopes.Session:
raise ValueError( raise ValueError(
'Both "Usage: Action" and "Scope: Session" are ' 'Both "Usage: Action" and "Scope: Session" are '

View File

@ -31,10 +31,12 @@ from muranoclient.glance import client as glare_client
from oslo_log import log as logging from oslo_log import log as logging
import yaml import yaml
from murano.common.i18n import _LW, _LE
from murano.services import states from murano.services import states
import murano.tests.functional.common.zip_utils_mixin as zip_utils import murano.tests.functional.common.zip_utils_mixin as zip_utils
import murano.tests.functional.engine.config as cfg import murano.tests.functional.engine.config as cfg
CONF = cfg.cfg.CONF CONF = cfg.cfg.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -201,7 +203,7 @@ class DeployTestMixin(zip_utils.ZipUtilsMixin):
deployment = cls.get_last_deployment(environment) deployment = cls.get_last_deployment(environment)
try: try:
details = deployment.result['result']['details'] details = deployment.result['result']['details']
LOG.warning('Details:\n {details}'.format(details=details)) LOG.warning(_LW('Details:\n {details}').format(details=details))
except Exception as e: except Exception as e:
LOG.error(e) LOG.error(e)
report = cls.get_deployment_report(environment, deployment) report = cls.get_deployment_report(environment, deployment)
@ -335,7 +337,8 @@ class DeployTestMixin(zip_utils.ZipUtilsMixin):
service_type='application-catalog', endpoint_type='publicURL') service_type='application-catalog', endpoint_type='publicURL')
except ks_exceptions.EndpointNotFound: except ks_exceptions.EndpointNotFound:
url = CONF.murano.murano_url url = CONF.murano.murano_url
LOG.warning("Murano endpoint not found in Keystone. Using CONF.") LOG.warning(_LW("Murano endpoint not found in Keystone. "
"Using CONF."))
return url if 'v1' not in url else "/".join( return url if 'v1' not in url else "/".join(
url.split('/')[:url.split('/').index('v1')]) url.split('/')[:url.split('/').index('v1')])
@ -359,7 +362,7 @@ class DeployTestMixin(zip_utils.ZipUtilsMixin):
raise RuntimeError('Resource at {0}:{1} not exist'. raise RuntimeError('Resource at {0}:{1} not exist'.
format(ip, port)) format(ip, port))
except socket.error as e: except socket.error as e:
LOG.error('Socket Error: {error}'.format(error=e)) LOG.error(_LE('Socket Error: {error}').format(error=e))
@classmethod @classmethod
def get_ip_by_appname(cls, environment, appname): def get_ip_by_appname(cls, environment, appname):