Browse Source

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
tags/3.9.0
Gábor Antal 2 years ago
parent
commit
1c91e9828d

+ 2
- 2
openstackclient/compute/v2/aggregate.py View File

@@ -128,8 +128,8 @@ class DeleteAggregate(command.Command):
128 128
             except Exception as e:
129 129
                 result += 1
130 130
                 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})
133 133
 
134 134
         if result > 0:
135 135
             total = len(parsed_args.aggregate)

+ 3
- 4
openstackclient/compute/v2/flavor.py View File

@@ -171,7 +171,7 @@ class CreateFlavor(command.ShowOne):
171 171
             except Exception as e:
172 172
                 msg = _("Failed to add project %(project)s access to "
173 173
                         "flavor: %(e)s")
174
-                LOG.error(msg % {'project': parsed_args.project, 'e': e})
174
+                LOG.error(msg, {'project': parsed_args.project, 'e': e})
175 175
         if parsed_args.property:
176 176
             try:
177 177
                 flavor.set_keys(parsed_args.property)
@@ -208,8 +208,7 @@ class DeleteFlavor(command.Command):
208 208
             except Exception as e:
209 209
                 result += 1
210 210
                 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})
213 212
 
214 213
         if result > 0:
215 214
             total = len(parsed_args.flavor)
@@ -395,7 +394,7 @@ class ShowFlavor(command.ShowOne):
395 394
             except Exception as e:
396 395
                 msg = _("Failed to get access projects list "
397 396
                         "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})
399 398
 
400 399
         flavor = resource_flavor._info.copy()
401 400
         flavor.update({

+ 1
- 2
openstackclient/compute/v2/keypair.py View File

@@ -106,8 +106,7 @@ class DeleteKeypair(command.Command):
106 106
             except Exception as e:
107 107
                 result += 1
108 108
                 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})
111 110
 
112 111
         if result > 0:
113 112
             total = len(parsed_args.name)

+ 1
- 2
openstackclient/compute/v2/service.py View File

@@ -50,8 +50,7 @@ class DeleteService(command.Command):
50 50
             except Exception as e:
51 51
                 result += 1
52 52
                 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})
55 54
 
56 55
         if result > 0:
57 56
             total = len(parsed_args.service)

Loading…
Cancel
Save