Browse Source

Following the hacking rule for string interpolation at logging

String interpolation should be delayed to be handled
by the logging code, rather than being done
at the point of the logging call.

See the oslo i18n guideline.

* http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

* http://docs.openstack.org/developer/oslo.i18n/guidelines.html#avoid-forcing-the-translation-of-translatable-variables


Change-Id: I96eaede777ca60c7ba2b83ea6968108910b62953
Closes-Bug: #1596829
tags/6.1.0
Bharath kumar 3 years ago
parent
commit
598dee274c

+ 5
- 6
ironic/conductor/manager.py View File

@@ -164,8 +164,8 @@ class ConductorManager(base_manager.BaseConductorManager):
164 164
 
165 165
         """
166 166
         LOG.debug("RPC change_node_power_state called for node %(node)s. "
167
-                  "The desired new state is %(state)s."
168
-                  % {'node': node_id, 'state': new_state})
167
+                  "The desired new state is %(state)s.",
168
+                  {'node': node_id, 'state': new_state})
169 169
 
170 170
         with task_manager.acquire(context, node_id, shared=False,
171 171
                                   purpose='changing node power state') as task:
@@ -1580,8 +1580,7 @@ class ConductorManager(base_manager.BaseConductorManager):
1580 1580
                  async task
1581 1581
         """
1582 1582
         LOG.debug('RPC set_console_mode called for node %(node)s with '
1583
-                  'enabled %(enabled)s' % {'node': node_id,
1584
-                                           'enabled': enabled})
1583
+                  'enabled %(enabled)s', {'node': node_id, 'enabled': enabled})
1585 1584
 
1586 1585
         with task_manager.acquire(context, node_id, shared=False,
1587 1586
                                   purpose='setting console mode') as task:
@@ -2526,8 +2525,8 @@ def _do_inspect_hardware(task):
2526 2525
 
2527 2526
     if new_state == states.MANAGEABLE:
2528 2527
         task.process_event('done')
2529
-        LOG.info(_LI('Successfully inspected node %(node)s')
2530
-                 % {'node': node.uuid})
2528
+        LOG.info(_LI('Successfully inspected node %(node)s'),
2529
+                 {'node': node.uuid})
2531 2530
     elif new_state != states.INSPECTING:
2532 2531
         error = (_("During inspection, driver returned unexpected "
2533 2532
                    "state %(state)s") % {'state': new_state})

+ 1
- 1
ironic/drivers/modules/ilo/common.py View File

@@ -708,7 +708,7 @@ def verify_image_checksum(image_location, expected_checksum):
708 708
         LOG.error(_LE("Error opening file: %(file)s"),
709 709
                   {'file': image_location})
710 710
         raise exception.ImageRefValidationFailed(image_href=image_location,
711
-                                                 reason=six.text_type(e))
711
+                                                 reason=e)
712 712
 
713 713
     if actual_checksum != expected_checksum:
714 714
         msg = (_('Error verifying image checksum. Image %(image)s failed to '

+ 1
- 2
ironic/drivers/modules/seamicro.py View File

@@ -24,7 +24,6 @@ import re
24 24
 from oslo_log import log as logging
25 25
 from oslo_service import loopingcall
26 26
 from oslo_utils import importutils
27
-import six
28 27
 from six.moves.urllib import parse as urlparse
29 28
 
30 29
 from ironic.common import boot_devices
@@ -564,7 +563,7 @@ class Management(base.ManagementInterface):
564 563
             LOG.error(_LE("Seamicro set boot device failed for node "
565 564
                           "%(node)s with the following error: %(error)s"),
566 565
                       {'node': task.node.uuid, 'error': ex})
567
-            raise exception.IronicException(message=six.text_type(ex))
566
+            raise exception.IronicException(ex)
568 567
 
569 568
     def get_boot_device(self, task):
570 569
         """Get the current boot device for the task's node.

Loading…
Cancel
Save