Browse Source

Replace deprecated LOG.warn with LOG.warning

Change-Id: Ib3d566f6e608ee453659e15cabcf8e9332aedc52
Closes-Bug: #1508442
tags/1.1.0
Zhenguo Niu 3 years ago
parent
commit
18d5d6aba3
2 changed files with 8 additions and 8 deletions
  1. 4
    4
      ironic_python_agent/hardware.py
  2. 4
    4
      ironic_python_agent/inspector.py

+ 4
- 4
ironic_python_agent/hardware.py View File

@@ -399,7 +399,7 @@ class GenericHardwareManager(HardwareManager):
399 399
             out, _e = utils.execute("dmidecode --type memory | grep Size",
400 400
                                     shell=True)
401 401
         except (processutils.ProcessExecutionError, OSError) as e:
402
-            LOG.warn("Cannot get real physical memory size: %s", e)
402
+            LOG.warning("Cannot get real physical memory size: %s", e)
403 403
             physical = None
404 404
         else:
405 405
             physical = 0
@@ -416,8 +416,8 @@ class GenericHardwareManager(HardwareManager):
416 416
                               line, exc)
417 417
 
418 418
             if not physical:
419
-                LOG.warn('failed to get real physical RAM, dmidecode returned '
420
-                         '%s', out)
419
+                LOG.warning('failed to get real physical RAM, dmidecode '
420
+                            'returned %s', out)
421 421
 
422 422
         return Memory(total=total, physical_mb=physical)
423 423
 
@@ -601,7 +601,7 @@ class GenericHardwareManager(HardwareManager):
601 601
                 "| awk '{ print $4 }'", shell=True)
602 602
         except (processutils.ProcessExecutionError, OSError) as e:
603 603
             # Not error, because it's normal in virtual environment
604
-            LOG.warn("Cannot get BMC address: %s", e)
604
+            LOG.warning("Cannot get BMC address: %s", e)
605 605
             return
606 606
 
607 607
         return out.strip()

+ 4
- 4
ironic_python_agent/inspector.py View File

@@ -207,8 +207,8 @@ def discover_scheduling_properties(inventory, data, root_disk=None):
207 207
         try:
208 208
             data[key] = int(data[key])
209 209
         except (KeyError, ValueError, TypeError):
210
-            LOG.warn('value for %s is missing or malformed: %s',
211
-                     key, data.get(key))
210
+            LOG.warning('value for %s is missing or malformed: %s',
211
+                        key, data.get(key))
212 212
         else:
213 213
             LOG.info('value for %s is %s', key, data[key])
214 214
 
@@ -240,7 +240,7 @@ def collect_default(data, failures):
240 240
         root_disk = utils.guess_root_disk(inventory['disks'][:])
241 241
     except errors.DeviceNotFound:
242 242
         root_disk = None
243
-        LOG.warn('no suitable root device detected')
243
+        LOG.warning('no suitable root device detected')
244 244
     else:
245 245
         data['root_disk'] = root_disk
246 246
         LOG.debug('default root device is %s', root_disk.name)
@@ -276,7 +276,7 @@ def collect_logs(data, failures):
276 276
         out, _e = utils.execute('journalctl', '--full', '--no-pager', '-b',
277 277
                                 '-n', '10000')
278 278
     except (processutils.ProcessExecutionError, OSError):
279
-        LOG.warn('failed to get system journal')
279
+        LOG.warning('failed to get system journal')
280 280
         return
281 281
 
282 282
     journal = io.BytesIO(out.encode('utf-8'))

Loading…
Cancel
Save