Fix formatting strings in LOG.warning

Uses a variable to hold the log message to make the code a little easier to read.

Change-Id: I20846fcc62cae056290f91e03ec73d2440832947
This commit is contained in:
Nam Nguyen Hoai
2016-08-30 13:29:39 +07:00
committed by David Stanek
parent 0ec3b88a31
commit 3adb15826f
2 changed files with 7 additions and 7 deletions

View File

@@ -1697,9 +1697,10 @@ class BaseLdap(object):
not_deleted_nodes.append(node_dn)
if not_deleted_nodes:
LOG.warning(_LW('When deleting entries for %(search_base)s, '
'could not delete nonexistent entries '
'%(entries)s%(dots)s'),
msg = _LW('When deleting entries for %(search_base)s, '
'could not delete nonexistent entries '
'%(entries)s%(dots)s')
LOG.warning(msg,
{'search_base': search_base,
'entries': not_deleted_nodes[:3],
'dots': '...' if len(not_deleted_nodes) > 3 else ''})

View File

@@ -134,10 +134,9 @@ class Identity(base.IdentityDriverV8):
try:
super(GroupApi, self.group).remove_member(user_dn, group_dn)
except ldap.NO_SUCH_ATTRIBUTE:
LOG.warning(
_LW('User %(user)s was not removed from group %(group)s '
'because the relationship was not found'),
{'user': user_id, 'group': group['id']})
msg = _LW('User %(user)s was not removed from group %(group)s '
'because the relationship was not found')
LOG.warning(msg, {'user': user_id, 'group': group['id']})
if hasattr(user, 'tenant_id'):
self.project.remove_user(user.tenant_id, user_dn)