Browse Source

Fix string interpolation to delayed to be handled by the logging code

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

Change-Id: I410acf693d8b7b1677a7f5b1749d9c1a48aaf177
Closes-Bug: #1596829
tags/1.5.0
weiweigu 3 years ago
parent
commit
e2506d1199

+ 2
- 2
os_brick/initiator/connector.py View File

@@ -148,7 +148,7 @@ def get_connector_properties(root_helper, my_ip, multipath, enforce_multipath,
148 148
 
149 149
         if (utils.platform_matches(props['platform'], connector.platform) and
150 150
            utils.os_matches(props['os_type'], connector.os_type)):
151
-            LOG.debug("Fetching connector for %s" % connector.__name__)
151
+            LOG.debug("Fetching connector for %s", connector.__name__)
152 152
             props = utils.merge_dict(props,
153 153
                                      connector.get_connector_properties(
154 154
                                          root_helper,
@@ -3063,7 +3063,7 @@ class DISCOConnector(BaseLinuxConnector):
3063 3063
     def _mount_disco_volume(self, path, volume_id):
3064 3064
         """Send request to mount volume on physical host."""
3065 3065
         LOG.debug("Enter in mount disco volume %(port)s "
3066
-                  "and %(ip)s." %
3066
+                  "and %(ip)s.",
3067 3067
                   {'port': self.server_port,
3068 3068
                    'ip': self.server_ip})
3069 3069
 

+ 12
- 12
os_brick/tests/initiator/test_connector.py View File

@@ -2010,8 +2010,8 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
2010 2010
                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
2011 2011
                              self.fake_sdscli_file + ' -c querydev'
2012 2012
                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
2013
-        LOG.debug("self.cmds = %s." % self.cmds)
2014
-        LOG.debug("expected = %s." % expected_commands)
2013
+        LOG.debug("self.cmds = %s.", self.cmds)
2014
+        LOG.debug("expected = %s.", expected_commands)
2015 2015
 
2016 2016
         self.assertEqual(expected_commands, self.cmds)
2017 2017
 
@@ -2030,8 +2030,8 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
2030 2030
                              self.fake_sdscli_file + ' -c detach'
2031 2031
                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
2032 2032
 
2033
-        LOG.debug("self.cmds = %s." % self.cmds)
2034
-        LOG.debug("expected = %s." % expected_commands)
2033
+        LOG.debug("self.cmds = %s.", self.cmds)
2034
+        LOG.debug("expected = %s.", expected_commands)
2035 2035
 
2036 2036
         self.assertEqual(expected_commands, self.cmds)
2037 2037
 
@@ -2062,8 +2062,8 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
2062 2062
                              self.fake_sdscli_file + ' -c querydev'
2063 2063
                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
2064 2064
 
2065
-        LOG.debug("self.cmds = %s." % self.cmds)
2066
-        LOG.debug("expected = %s." % expected_commands)
2065
+        LOG.debug("self.cmds = %s.", self.cmds)
2066
+        LOG.debug("expected = %s.", expected_commands)
2067 2067
 
2068 2068
         self.assertEqual(expected_commands, self.cmds)
2069 2069
 
@@ -2082,8 +2082,8 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
2082 2082
                           self.connection_properties)
2083 2083
         expected_commands = [self.fake_sdscli_file + ' -c attach'
2084 2084
                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
2085
-        LOG.debug("self.cmds = %s." % self.cmds)
2086
-        LOG.debug("expected = %s." % expected_commands)
2085
+        LOG.debug("self.cmds = %s.", self.cmds)
2086
+        LOG.debug("expected = %s.", expected_commands)
2087 2087
         self.assertEqual(expected_commands, self.cmds)
2088 2088
 
2089 2089
     def test_disconnect_volume_fail(self):
@@ -2102,8 +2102,8 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
2102 2102
                              self.fake_sdscli_file + ' -c detach'
2103 2103
                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
2104 2104
 
2105
-        LOG.debug("self.cmds = %s." % self.cmds)
2106
-        LOG.debug("expected = %s." % expected_commands)
2105
+        LOG.debug("self.cmds = %s.", self.cmds)
2106
+        LOG.debug("expected = %s.", expected_commands)
2107 2107
 
2108 2108
         self.assertEqual(expected_commands, self.cmds)
2109 2109
 
@@ -2126,8 +2126,8 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
2126 2126
                              self.fake_sdscli_file + ' -c querydev'
2127 2127
                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
2128 2128
 
2129
-        LOG.debug("self.cmds = %s." % self.cmds)
2130
-        LOG.debug("expected = %s." % expected_commands)
2129
+        LOG.debug("self.cmds = %s.", self.cmds)
2130
+        LOG.debug("expected = %s.", expected_commands)
2131 2131
 
2132 2132
     def test_extend_volume(self):
2133 2133
         self.assertRaises(NotImplementedError,

+ 1
- 1
os_brick/tests/initiator/test_linuxscsi.py View File

@@ -477,7 +477,7 @@ loop0                                     0"""
477 477
 
478 478
         self.linuxscsi._execute = fake_execute
479 479
         info = self.linuxscsi.find_multipath_device('/dev/sdd')
480
-        LOG.error("Device info: %s" % info)
480
+        LOG.error("Device info: %s", info)
481 481
 
482 482
         self.assertEqual('36005076303ffc48e0000000000000101', info['id'])
483 483
         self.assertEqual('36005076303ffc48e0000000000000101', info['name'])

Loading…
Cancel
Save