Fix formatting strings when using multiple variables
Following OpenStack Style Guidelines:[H703] http://docs.openstack.org/developer/hacking/#internationalization-i18n-strings Using multiple variables for formmatting strings is not clear as using explicit dictionaries and can hide errors during refactoring. Change-Id: I9f15dc5b8e491cdb8ef9037fc56d912496bc66ea
This commit is contained in:
parent
bda961ba6a
commit
4c2d27ea40
|
@ -267,8 +267,8 @@ class LoadBalancerDriver(base.DriverBase):
|
|||
node_detail = node.get_details(oslo_context.get_current())
|
||||
addresses = node_detail.get('addresses')
|
||||
if net_name not in addresses:
|
||||
LOG.error(_LE('Node is not in subnet %(subnet)s'),
|
||||
{'subnet': subnet})
|
||||
msg = _LE('Node is not in subnet %(subnet)s')
|
||||
LOG.error(msg, {'subnet': subnet})
|
||||
return None
|
||||
|
||||
# Use the first IP address if more than one are found in target network
|
||||
|
|
|
@ -714,9 +714,9 @@ class ClusterAction(base.Action):
|
|||
# desired is checked when strict is True
|
||||
curr_size = len(self.cluster.nodes)
|
||||
if count > curr_size:
|
||||
LOG.warning(_('Triming count (%(count)s) to current cluster size '
|
||||
'(%(curr)s) for scaling in'),
|
||||
{'count': count, 'curr': curr_size})
|
||||
msg = _("Triming count (%(count)s) to current "
|
||||
"cluster size (%(curr)s) for scaling in")
|
||||
LOG.warning(msg, {'count': count, 'curr': curr_size})
|
||||
count = curr_size
|
||||
new_size = curr_size - count
|
||||
|
||||
|
|
|
@ -126,7 +126,8 @@ def error(context, entity, action, status=None, status_reason=None,
|
|||
action=action, status=status, status_reason=status_reason,
|
||||
user=context.user, project=context.project)
|
||||
event.store(context)
|
||||
LOG.error(_LE('%(name)s [%(id)s] %(action)s - %(status)s: %(reason)s'),
|
||||
msg = _LE('%(name)s [%(id)s] %(action)s - %(status)s: %(reason)s')
|
||||
LOG.error(msg,
|
||||
{'name': event.oname,
|
||||
'id': event.oid and event.oid[:8],
|
||||
'action': action,
|
||||
|
@ -141,7 +142,8 @@ def warning(context, entity, action, status=None, status_reason=None,
|
|||
action=action, status=status, status_reason=status_reason,
|
||||
user=context.user, project=context.project)
|
||||
event.store(context)
|
||||
LOG.warning(_LW('%(name)s [%(id)s] %(action)s - %(status)s: %(reason)s'),
|
||||
msg = _LW('%(name)s [%(id)s] %(action)s - %(status)s: %(reason)s')
|
||||
LOG.warning(msg,
|
||||
{'name': event.oname,
|
||||
'id': event.oid and event.oid[:8],
|
||||
'action': action,
|
||||
|
|
|
@ -81,7 +81,8 @@ class Registry(object):
|
|||
registry = self._registry
|
||||
if info is None:
|
||||
# delete this entry.
|
||||
LOG.warning(_LW('Removing %(item)s from registry'), {'item': name})
|
||||
msg = _LW("Removing %(item)s from registry")
|
||||
LOG.warning(msg, {'item': name})
|
||||
registry.pop(name, None)
|
||||
return
|
||||
|
||||
|
@ -96,8 +97,8 @@ class Registry(object):
|
|||
LOG.warning(_LW('Changing %(name)s from %(old)s to %(new)s'),
|
||||
details)
|
||||
else:
|
||||
LOG.info(_LI('Registering %(name)s -> %(value)s'), {
|
||||
'name': name, 'value': str(info.plugin)})
|
||||
msg = _LI('Registering %(name)s -> %(value)s')
|
||||
LOG.info(msg, {'name': name, 'value': str(info.plugin)})
|
||||
|
||||
info.user_provided = not self.is_global
|
||||
registry[name] = info
|
||||
|
|
Loading…
Reference in New Issue