Browse Source

Replace deprecated LOG.warn with LOG.warning

LOG.warn is deprecated so this replaces it with LOG.warning.

Change-Id: I4b7b55cce2cfb3f0ae779351daf14e42472d43de
Closes-Bug: 1508442
tags/0.5.0
Ruby Loo 3 years ago
parent
commit
bf3938e439
3 changed files with 7 additions and 7 deletions
  1. 4
    4
      ironic_lib/disk_utils.py
  2. 1
    1
      ironic_lib/tests/test_disk_utils.py
  3. 2
    2
      ironic_lib/utils.py

+ 4
- 4
ironic_lib/disk_utils.py View File

@@ -87,10 +87,10 @@ def list_partitions(device):
87 87
     for line in lines:
88 88
         match = _PARTED_PRINT_RE.match(line)
89 89
         if match is None:
90
-            LOG.warn(_LW("Partition information from parted for device "
91
-                         "%(device)s does not match "
92
-                         "expected format: %(line)s"),
93
-                     dict(device=device, line=line))
90
+            LOG.warning(_LW("Partition information from parted for device "
91
+                            "%(device)s does not match "
92
+                            "expected format: %(line)s"),
93
+                        dict(device=device, line=line))
94 94
             continue
95 95
         # Cast int fields to ints (some are floats and we round them down)
96 96
         groups = [int(float(x)) if i < 4 else x

+ 1
- 1
ironic_lib/tests/test_disk_utils.py View File

@@ -58,7 +58,7 @@ BYT;
58 58
             'parted', '-s', '-m', '/dev/fake', 'unit', 'MiB', 'print',
59 59
             use_standard_locale=True, run_as_root=True)
60 60
 
61
-    @mock.patch.object(disk_utils.LOG, 'warn')
61
+    @mock.patch.object(disk_utils.LOG, 'warning')
62 62
     def test_incorrect(self, log_mock, execute_mock):
63 63
         output = """
64 64
 BYT;

+ 2
- 2
ironic_lib/utils.py View File

@@ -119,8 +119,8 @@ def unlink_without_raise(path):
119 119
         if e.errno == errno.ENOENT:
120 120
             return
121 121
         else:
122
-            LOG.warn(_LW("Failed to unlink %(path)s, error: %(e)s"),
123
-                     {'path': path, 'e': e})
122
+            LOG.warning(_LW("Failed to unlink %(path)s, error: %(e)s"),
123
+                        {'path': path, 'e': e})
124 124
 
125 125
 
126 126
 def dd(src, dst, *args):

Loading…
Cancel
Save