all non debug log messages should be translated

Updated a set of files to add missing translation support in the
log messages.

Change-Id: I58d561c5e1ecff550483ee0be696999e927c98ad
Partial-Bug: #1321283
This commit is contained in:
Christian Berendt 2014-05-19 18:10:55 +02:00
parent 40c8de0c3f
commit 105a806493
11 changed files with 27 additions and 24 deletions

View File

@ -57,7 +57,8 @@ if __name__ == '__main__':
port = cfg.CONF.heat_api.bind_port port = cfg.CONF.heat_api.bind_port
host = cfg.CONF.heat_api.bind_host host = cfg.CONF.heat_api.bind_host
LOG.info('Starting Heat ReST API on %s:%s' % (host, port)) LOG.info(_('Starting Heat ReST API on %(host)s:%(port)s'),
{'host': host, 'port': port})
server = wsgi.Server() server = wsgi.Server()
server.start(app, cfg.CONF.heat_api, default_port=port) server.start(app, cfg.CONF.heat_api, default_port=port)
notify.startup_notify(cfg.CONF.onready) notify.startup_notify(cfg.CONF.onready)

View File

@ -59,7 +59,8 @@ if __name__ == '__main__':
port = cfg.CONF.heat_api_cfn.bind_port port = cfg.CONF.heat_api_cfn.bind_port
host = cfg.CONF.heat_api_cfn.bind_host host = cfg.CONF.heat_api_cfn.bind_host
LOG.info('Starting Heat API on %s:%s' % (host, port)) LOG.info(_('Starting Heat API on %(host)s:%(port)s'),
{'host': host, 'port': port})
server = wsgi.Server() server = wsgi.Server()
server.start(app, cfg.CONF.heat_api_cfn, default_port=port) server.start(app, cfg.CONF.heat_api_cfn, default_port=port)
notify.startup_notify(cfg.CONF.onready) notify.startup_notify(cfg.CONF.onready)

View File

@ -59,7 +59,8 @@ if __name__ == '__main__':
port = cfg.CONF.heat_api_cloudwatch.bind_port port = cfg.CONF.heat_api_cloudwatch.bind_port
host = cfg.CONF.heat_api_cloudwatch.bind_host host = cfg.CONF.heat_api_cloudwatch.bind_host
LOG.info('Starting Heat CloudWatch API on %s:%s' % (host, port)) LOG.info(_('Starting Heat CloudWatch API on %(host)s:%(port)s'),
{'host': host, 'port': port})
server = wsgi.Server() server = wsgi.Server()
server.start(app, cfg.CONF.heat_api_cloudwatch, default_port=port) server.start(app, cfg.CONF.heat_api_cloudwatch, default_port=port)
notify.startup_notify(cfg.CONF.onready) notify.startup_notify(cfg.CONF.onready)

View File

@ -109,8 +109,8 @@ class KeystoneClientV2(object):
# Ensure the v2 API we're using is not impacted by keystone # Ensure the v2 API we're using is not impacted by keystone
# bug #1239303, otherwise we can't trust the user_id # bug #1239303, otherwise we can't trust the user_id
if self.context.trustor_user_id != client.auth_ref.user_id: if self.context.trustor_user_id != client.auth_ref.user_id:
LOG.error("Trust impersonation failed, bug #1239303 " LOG.error(_("Trust impersonation failed, bug #1239303 "
"suspected, you may need a newer keystone") "suspected, you may need a newer keystone"))
raise exception.AuthorizationFailure() raise exception.AuthorizationFailure()
return client return client

View File

@ -103,7 +103,7 @@ class NovaFlavor(resource.Resource):
self.nova().flavors.delete(self.resource_id) self.nova().flavors.delete(self.resource_id)
except nova_exceptions.NotFound: except nova_exceptions.NotFound:
LOG.debug( LOG.debug(
_('Could not find flavor %s.') % self.resource_id) 'Could not find flavor %s.' % self.resource_id)
self.resource_id_set(None) self.resource_id_set(None)

View File

@ -421,7 +421,7 @@ class StackController(object):
msg = _("The Template must be a JSON or YAML document.") msg = _("The Template must be a JSON or YAML document.")
return exception.HeatInvalidParameterValueError(detail=msg) return exception.HeatInvalidParameterValueError(detail=msg)
LOG.info('validate_template') LOG.info(_('validate_template'))
def format_validate_parameter(key, value): def format_validate_parameter(key, value):
""" """

View File

@ -46,7 +46,7 @@ def call(args):
def write(self, data): def write(self, data):
LOG.info(data) LOG.info(data)
LOG.info('%s\n' % ' '.join(args)) LOG.info('%s\n', ' '.join(args)) # noqa
try: try:
ls = LogStream() ls = LogStream()
p = subprocess.Popen(args, stdout=subprocess.PIPE, p = subprocess.Popen(args, stdout=subprocess.PIPE,
@ -57,13 +57,13 @@ def call(args):
ls.write(x) ls.write(x)
except OSError as ex: except OSError as ex:
if ex.errno == errno.ENOEXEC: if ex.errno == errno.ENOEXEC:
LOG.error('Userdata empty or not executable: %s\n' % str(ex)) LOG.error(_('Userdata empty or not executable: %s'), ex)
return os.EX_OK return os.EX_OK
else: else:
LOG.error('OS error running userdata: %s\n' % str(ex)) LOG.error(_('OS error running userdata: %s'), ex)
return os.EX_OSERR return os.EX_OSERR
except Exception as ex: except Exception as ex:
LOG.error('Unknown error running userdata: %s\n' % str(ex)) LOG.error(_('Unknown error running userdata: %s'), ex)
return os.EX_SOFTWARE return os.EX_SOFTWARE
return p.returncode return p.returncode
@ -72,16 +72,16 @@ def main():
if not chk_ci_version(): if not chk_ci_version():
# pre 0.6.0 - user data executed via cloudinit, not this helper # pre 0.6.0 - user data executed via cloudinit, not this helper
LOG.error('Unable to log provisioning, need a newer version of' LOG.error(_('Unable to log provisioning, need a newer version of'
' cloud-init\n') ' cloud-init'))
return -1 return -1
userdata_path = os.path.join(VAR_PATH, 'cfn-userdata') userdata_path = os.path.join(VAR_PATH, 'cfn-userdata')
os.chmod(userdata_path, 0o700) os.chmod(userdata_path, 0o700)
LOG.info('Provision began: %s\n' % datetime.datetime.now()) LOG.info(_('Provision began: %s'), datetime.datetime.now())
returncode = call([userdata_path]) returncode = call([userdata_path])
LOG.info('Provision done: %s\n' % datetime.datetime.now()) LOG.info(_('Provision done: %s'), datetime.datetime.now())
if returncode: if returncode:
return returncode return returncode
@ -91,7 +91,7 @@ if __name__ == '__main__':
code = main() code = main()
if code: if code:
LOG.error('Provision failed with exit code %s' % code) LOG.error(_('Provision failed with exit code %s'), code)
sys.exit(code) sys.exit(code)
provision_log = os.path.join(VAR_PATH, 'provision-finished') provision_log = os.path.join(VAR_PATH, 'provision-finished')

View File

@ -114,7 +114,7 @@ class HeatException(Exception):
#log the issue and the kwargs #log the issue and the kwargs
LOG.exception(_('Exception in string format operation')) LOG.exception(_('Exception in string format operation'))
for name, value in kwargs.iteritems(): for name, value in kwargs.iteritems():
LOG.error("%s: %s" % (name, value)) LOG.error("%s: %s" % (name, value)) # noqa
if _FATAL_EXCEPTION_FORMAT_ERRORS: if _FATAL_EXCEPTION_FORMAT_ERRORS:
raise exc_info[0], exc_info[1], exc_info[2] raise exc_info[0], exc_info[1], exc_info[2]

View File

@ -119,7 +119,7 @@ class KeystoneClientV3(object):
if c.authenticate(): if c.authenticate():
self._admin_client = c self._admin_client = c
else: else:
LOG.error("Admin client authentication failed") LOG.error(_("Admin client authentication failed"))
raise exception.AuthorizationFailure() raise exception.AuthorizationFailure()
return self._admin_client return self._admin_client
@ -135,7 +135,7 @@ class KeystoneClientV3(object):
if c.authenticate(domain_id=self.stack_domain_id): if c.authenticate(domain_id=self.stack_domain_id):
self._domain_admin_client = c self._domain_admin_client = c
else: else:
LOG.error("Domain admin client authentication failed") LOG.error(_("Domain admin client authentication failed"))
raise exception.AuthorizationFailure() raise exception.AuthorizationFailure()
return self._domain_admin_client return self._domain_admin_client
@ -178,7 +178,7 @@ class KeystoneClientV3(object):
self.context.auth_url = kwargs.get('auth_url') self.context.auth_url = kwargs.get('auth_url')
# Sanity check that impersonation is effective # Sanity check that impersonation is effective
if self.context.trustor_user_id != client.auth_ref.user_id: if self.context.trustor_user_id != client.auth_ref.user_id:
LOG.error("Trust impersonation failed") LOG.error(_("Trust impersonation failed"))
raise exception.AuthorizationFailure() raise exception.AuthorizationFailure()
return client return client

View File

@ -386,7 +386,7 @@ class Resource(object):
while not check(handle_data): while not check(handle_data):
yield yield
except Exception as ex: except Exception as ex:
LOG.exception('%s : %s' % (action, str(self))) LOG.exception('%s : %s' % (action, str(self))) # noqa
failure = exception.ResourceFailure(ex, self, action) failure = exception.ResourceFailure(ex, self, action)
self.state_set(action, self.FAILED, six.text_type(failure)) self.state_set(action, self.FAILED, six.text_type(failure))
raise failure raise failure
@ -420,7 +420,7 @@ class Resource(object):
% str(self.state)) % str(self.state))
raise exception.ResourceFailure(exc, self, action) raise exception.ResourceFailure(exc, self, action)
LOG.info('creating %s' % str(self)) LOG.info(_('creating %s') % str(self))
# Re-resolve the template, since if the resource Ref's # Re-resolve the template, since if the resource Ref's
# the StackId pseudo parameter, it will change after # the StackId pseudo parameter, it will change after
@ -501,7 +501,7 @@ class Resource(object):
exc = Exception(_('Resource update already requested')) exc = Exception(_('Resource update already requested'))
raise exception.ResourceFailure(exc, self, action) raise exception.ResourceFailure(exc, self, action)
LOG.info('updating %s' % str(self)) LOG.info(_('updating %s') % str(self))
try: try:
self.updated_time = datetime.utcnow() self.updated_time = datetime.utcnow()

View File

@ -168,7 +168,7 @@ class SoftwareConfig(resource.Resource):
self.heat().software_configs.delete(self.resource_id) self.heat().software_configs.delete(self.resource_id)
except heat_exp.HTTPNotFound: except heat_exp.HTTPNotFound:
LOG.debug( LOG.debug(
_('Software config %s is not found.') % self.resource_id) 'Software config %s is not found.' % self.resource_id)
def _resolve_attribute(self, name): def _resolve_attribute(self, name):
''' '''