Browse Source

Merge "Stop logging lshw output, collect it with other logs instead" into stable/queens

stable/queens
Zuul 2 months ago
parent
commit
0bb161398a

+ 1
- 1
ironic_python_agent/hardware.py View File

@@ -72,7 +72,7 @@ def _get_system_lshw_dict():
72 72
 
73 73
     :return: A python dict from the lshw json output
74 74
     """
75
-    out, _e = utils.execute('lshw', '-quiet', '-json')
75
+    out, _e = utils.execute('lshw', '-quiet', '-json', log_stdout=False)
76 76
     return json.loads(out)
77 77
 
78 78
 

+ 6
- 4
ironic_python_agent/tests/unit/test_utils.py View File

@@ -436,12 +436,13 @@ class TestUtils(testtools.TestCase):
436 436
         self.assertEqual(ret, logs_string)
437 437
         mock_logs.assert_called_once_with(lines=None)
438 438
         calls = [mock.call(['ps', 'au']), mock.call(['df', '-a']),
439
-                 mock.call(['iptables', '-L']), mock.call(['ip', 'addr'])]
439
+                 mock.call(['iptables', '-L']), mock.call(['ip', 'addr']),
440
+                 mock.call(['lshw', '-quiet', '-json'])]
440 441
         mock_outputs.assert_has_calls(calls, any_order=True)
441 442
         mock_gzip_b64.assert_called_once_with(
442 443
             file_list=[],
443 444
             io_dict={'journal': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
444
-                     'df': mock.ANY, 'iptables': mock.ANY})
445
+                     'df': mock.ANY, 'iptables': mock.ANY, 'lshw': mock.ANY})
445 446
 
446 447
     @mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
447 448
     @mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@@ -456,12 +457,13 @@ class TestUtils(testtools.TestCase):
456 457
         self.assertEqual(ret, logs_string)
457 458
         calls = [mock.call(['dmesg']), mock.call(['ps', 'au']),
458 459
                  mock.call(['df', '-a']), mock.call(['iptables', '-L']),
459
-                 mock.call(['ip', 'addr'])]
460
+                 mock.call(['ip', 'addr']),
461
+                 mock.call(['lshw', '-quiet', '-json'])]
460 462
         mock_outputs.assert_has_calls(calls, any_order=True)
461 463
         mock_gzip_b64.assert_called_once_with(
462 464
             file_list=['/var/log'],
463 465
             io_dict={'iptables': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
464
-                     'dmesg': mock.ANY, 'df': mock.ANY})
466
+                     'dmesg': mock.ANY, 'df': mock.ANY, 'lshw': mock.ANY})
465 467
 
466 468
     def test_get_ssl_client_options(self):
467 469
         # defaults

+ 1
- 0
ironic_python_agent/utils.py View File

@@ -56,6 +56,7 @@ COLLECT_LOGS_COMMANDS = {
56 56
     'df': ['df', '-a'],
57 57
     'iptables': ['iptables', '-L'],
58 58
     'ip_addr': ['ip', 'addr'],
59
+    'lshw': ['lshw', '-quiet', '-json'],
59 60
 }
60 61
 
61 62
 

+ 5
- 0
releasenotes/notes/lshw-cb89894be057bdc9.yaml View File

@@ -0,0 +1,5 @@
1
+---
2
+fixes:
3
+  - |
4
+    The ``lshw`` output no longer pollutes the debug logging. Instead, it's
5
+    stored as part of the ramdisk logs.

Loading…
Cancel
Save