Skip to content

Commit 1c91e98

Browse files
committed
Handle log message interpolation by the logger in compute/
According to OpenStack Guideline[1], logged string message should be interpolated by the logger. [1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages Change-Id: Ib7b5fb5f794026fc8a84260c4803afea321a9cf5 Closes-Bug: #1596829
1 parent 0c42c88 commit 1c91e98

4 files changed

Lines changed: 7 additions & 10 deletions

File tree

openstackclient/compute/v2/aggregate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ def take_action(self, parsed_args):
128128
except Exception as e:
129129
result += 1
130130
LOG.error(_("Failed to delete aggregate with name or "
131-
"ID '%(aggregate)s': %(e)s")
132-
% {'aggregate': a, 'e': e})
131+
"ID '%(aggregate)s': %(e)s"),
132+
{'aggregate': a, 'e': e})
133133

134134
if result > 0:
135135
total = len(parsed_args.aggregate)

openstackclient/compute/v2/flavor.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def take_action(self, parsed_args):
171171
except Exception as e:
172172
msg = _("Failed to add project %(project)s access to "
173173
"flavor: %(e)s")
174-
LOG.error(msg % {'project': parsed_args.project, 'e': e})
174+
LOG.error(msg, {'project': parsed_args.project, 'e': e})
175175
if parsed_args.property:
176176
try:
177177
flavor.set_keys(parsed_args.property)
@@ -208,8 +208,7 @@ def take_action(self, parsed_args):
208208
except Exception as e:
209209
result += 1
210210
LOG.error(_("Failed to delete flavor with name or "
211-
"ID '%(flavor)s': %(e)s")
212-
% {'flavor': f, 'e': e})
211+
"ID '%(flavor)s': %(e)s"), {'flavor': f, 'e': e})
213212

214213
if result > 0:
215214
total = len(parsed_args.flavor)
@@ -395,7 +394,7 @@ def take_action(self, parsed_args):
395394
except Exception as e:
396395
msg = _("Failed to get access projects list "
397396
"for flavor '%(flavor)s': %(e)s")
398-
LOG.error(msg % {'flavor': parsed_args.flavor, 'e': e})
397+
LOG.error(msg, {'flavor': parsed_args.flavor, 'e': e})
399398

400399
flavor = resource_flavor._info.copy()
401400
flavor.update({

openstackclient/compute/v2/keypair.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ def take_action(self, parsed_args):
106106
except Exception as e:
107107
result += 1
108108
LOG.error(_("Failed to delete key with name "
109-
"'%(name)s': %(e)s")
110-
% {'name': n, 'e': e})
109+
"'%(name)s': %(e)s"), {'name': n, 'e': e})
111110

112111
if result > 0:
113112
total = len(parsed_args.name)

openstackclient/compute/v2/service.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ def take_action(self, parsed_args):
5050
except Exception as e:
5151
result += 1
5252
LOG.error(_("Failed to delete compute service with "
53-
"ID '%(service)s': %(e)s")
54-
% {'service': s, 'e': e})
53+
"ID '%(service)s': %(e)s"), {'service': s, 'e': e})
5554

5655
if result > 0:
5756
total = len(parsed_args.service)

0 commit comments

Comments
 (0)