Fix missing translations for error and info

Fixed log message translations at several missing places.

Closes-Bug: 1431239
Change-Id: I23ae9395a91ce88e0877c0a0ef55189c6e42700b
This commit is contained in:
ankitagrawal 2015-03-12 04:06:11 -07:00
parent f428567ec0
commit 8a95bf893d
8 changed files with 41 additions and 32 deletions

View File

@ -80,17 +80,17 @@ class PropertyRules(object):
conf_file = CONF.find_file(CONF.property_protection_file)
CONFIG.read(conf_file)
except Exception as e:
msg = (_("Couldn't find property protection file %(file)s: "
"%(error)s.") % {'file': CONF.property_protection_file,
'error': e})
msg = (_LE("Couldn't find property protection file %(file)s: "
"%(error)s.") % {'file': CONF.property_protection_file,
'error': e})
LOG.error(msg)
raise InvalidPropProtectConf()
if self.prop_prot_rule_format not in ['policies', 'roles']:
msg = _("Invalid value '%s' for "
"'property_protection_rule_format'. "
"The permitted values are "
"'roles' and 'policies'") % self.prop_prot_rule_format
msg = _LE("Invalid value '%s' for "
"'property_protection_rule_format'. "
"The permitted values are "
"'roles' and 'policies'") % self.prop_prot_rule_format
LOG.error(msg)
raise InvalidPropProtectConf()
@ -119,7 +119,7 @@ class PropertyRules(object):
permissions = [permission.strip() for permission in
permissions.split(',')]
if '@' in permissions and '!' in permissions:
msg = (_(
msg = (_LE(
"Malformed property protection rule in "
"[%(prop)s] %(op)s=%(perm)s: '@' and '!' "
"are mutually exclusive") %
@ -144,9 +144,9 @@ class PropertyRules(object):
try:
return re.compile(rule)
except Exception as e:
msg = (_("Encountered a malformed property protection rule"
" %(rule)s: %(error)s.") % {'rule': rule,
'error': e})
msg = (_LE("Encountered a malformed property protection rule"
" %(rule)s: %(error)s.") % {'rule': rule,
'error': e})
LOG.error(msg)
raise InvalidPropProtectConf()

View File

@ -34,6 +34,7 @@ import glance.openstack.common.log as logging
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
rpc_opts = [
@ -182,7 +183,7 @@ class Controller(object):
raise
cls, val = e.__class__, utils.exception_to_str(e)
msg = (_("RPC Call Error: %(val)s\n%(tb)s") %
msg = (_LE("RPC Call Error: %(val)s\n%(tb)s") %
dict(val=val, tb=traceback.format_exc()))
LOG.error(msg)

View File

@ -84,7 +84,7 @@ class SwiftParams(object):
conf_file = CONF.find_file(CONF.swift_store_config_file)
CONFIG.read(conf_file)
except Exception as e:
msg = (_("swift config file %(conf_file)s:%(exc)s not found") %
msg = (_LE("swift config file %(conf_file)s:%(exc)s not found") %
{'conf_file': CONF.swift_store_config_file, 'exc': e})
LOG.error(msg)
raise exception.InvalidSwiftStoreConfiguration()

View File

@ -53,6 +53,7 @@ CONF = cfg.CONF
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
FEATURE_BLACKLIST = ['content-length', 'content-type', 'x-image-meta-size']
@ -111,7 +112,7 @@ def cooperative_iter(iter):
yield chunk
except Exception as err:
with excutils.save_and_reraise_exception():
msg = _("Error: cooperative_iter exception %s") % err
msg = _LE("Error: cooperative_iter exception %s") % err
LOG.error(msg)
@ -510,10 +511,10 @@ def mutating(func):
def setup_remote_pydev_debug(host, port):
error_msg = _('Error setting up the debug environment. Verify that the'
' option pydev_worker_debug_host is pointing to a valid '
'hostname or IP on which a pydev server is listening on'
' the port indicated by pydev_worker_debug_port.')
error_msg = _LE('Error setting up the debug environment. Verify that the'
' option pydev_worker_debug_host is pointing to a valid '
'hostname or IP on which a pydev server is listening on'
' the port indicated by pydev_worker_debug_port.')
try:
try:

View File

@ -30,6 +30,7 @@ import glance.openstack.common.log as logging
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
@ -373,15 +374,15 @@ class Task(object):
def _set_task_status(self, new_status):
if self._validate_task_status_transition(self.status, new_status):
self._status = new_status
log_msg = (_("Task [%(task_id)s] status changing from "
"%(cur_status)s to %(new_status)s") %
log_msg = (_LI("Task [%(task_id)s] status changing from "
"%(cur_status)s to %(new_status)s") %
{'task_id': self.task_id, 'cur_status': self.status,
'new_status': new_status})
LOG.info(log_msg)
self._status = new_status
else:
log_msg = (_("Task [%(task_id)s] status failed to change from "
"%(cur_status)s to %(new_status)s") %
log_msg = (_LE("Task [%(task_id)s] status failed to change from "
"%(cur_status)s to %(new_status)s") %
{'task_id': self.task_id, 'cur_status': self.status,
'new_status': new_status})
LOG.error(log_msg)

View File

@ -69,6 +69,7 @@ from glance.image_cache.drivers import base
import glance.openstack.common.log as logging
LOG = logging.getLogger(__name__)
_ = i18n._
_LE = i18n._LE
_LI = i18n._LI
_LW = i18n._LW
@ -106,11 +107,11 @@ class Driver(base.Driver):
set_xattr(fake_image_filepath, 'hits', '1')
except IOError as e:
if e.errno == errno.EOPNOTSUPP:
msg = (_LE("The device housing the image cache directory "
"%(image_cache_dir)s does not support xattr. It is"
" likely you need to edit your fstab and add the "
"user_xattr option to the appropriate line for the"
" device housing the cache directory.") %
msg = (_("The device housing the image cache directory "
"%(image_cache_dir)s does not support xattr. It is"
" likely you need to edit your fstab and add the "
"user_xattr option to the appropriate line for the"
" device housing the cache directory.") %
{'image_cache_dir': image_cache_dir})
LOG.error(msg)
raise exception.BadDriverConfiguration(driver_name="xattr",

View File

@ -31,6 +31,7 @@ from glance import i18n
import glance.openstack.common.log as logging
_ = i18n._
_LE = i18n._LE
notifier_opts = [
cfg.StrOpt('default_publisher_id', default="image.localhost",
@ -357,8 +358,8 @@ class ImageProxy(NotificationProxy, domain_proxy.Image):
_send_notification(notify, 'image.send',
self._format_image_send(sent))
except Exception as err:
msg = (_("An error occurred during image.send"
" notification: %(err)s") % {'err': err})
msg = (_LE("An error occurred during image.send"
" notification: %(err)s") % {'err': err})
LOG.error(msg)
def get_data(self, offset=0, chunk_size=None):

View File

@ -26,6 +26,7 @@ import glance.registry.context
_ = i18n._
_LC = i18n._LC
_LE = i18n._LE
_LI = i18n._LI
LOG = logging.getLogger(__name__)
@ -55,13 +56,16 @@ def build_image_owner_map(owner_map, db, context):
try:
owner_id = owner_map[owner_name]
except KeyError:
msg = 'Image %s owner %s was not found. Skipping.'
LOG.error(msg % (image_id, owner_name))
msg = (_LE('Image "%(image)s" owner "%(owner)s" was not found. '
'Skipping.'),
{'image': image_id, 'owner': owner_name})
LOG.error(msg)
continue
image_owner_map[image_id] = owner_id
msg = 'Image %s owner %s -> %s' % (image_id, owner_name, owner_id)
msg = (_LI('Image "%(image)s" owner "%(owner)s" -> "%(owner_id)s"'),
{'image': image_id, 'owner': owner_name, 'owner_id': owner_id})
LOG.info(msg)
return image_owner_map