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

This commit is contained in:
Zuul 2019-07-03 17:21:29 +00:00 committed by Gerrit Code Review
commit 0bb161398a
4 changed files with 13 additions and 5 deletions

View File

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

View File

@ -436,12 +436,13 @@ class TestUtils(testtools.TestCase):
self.assertEqual(ret, logs_string) self.assertEqual(ret, logs_string)
mock_logs.assert_called_once_with(lines=None) mock_logs.assert_called_once_with(lines=None)
calls = [mock.call(['ps', 'au']), mock.call(['df', '-a']), calls = [mock.call(['ps', 'au']), mock.call(['df', '-a']),
mock.call(['iptables', '-L']), mock.call(['ip', 'addr'])] mock.call(['iptables', '-L']), mock.call(['ip', 'addr']),
mock.call(['lshw', '-quiet', '-json'])]
mock_outputs.assert_has_calls(calls, any_order=True) mock_outputs.assert_has_calls(calls, any_order=True)
mock_gzip_b64.assert_called_once_with( mock_gzip_b64.assert_called_once_with(
file_list=[], file_list=[],
io_dict={'journal': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY, io_dict={'journal': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
'df': mock.ANY, 'iptables': mock.ANY}) 'df': mock.ANY, 'iptables': mock.ANY, 'lshw': mock.ANY})
@mock.patch.object(utils, 'gzip_and_b64encode', autospec=True) @mock.patch.object(utils, 'gzip_and_b64encode', autospec=True)
@mock.patch.object(utils, 'is_journalctl_present', autospec=True) @mock.patch.object(utils, 'is_journalctl_present', autospec=True)
@ -456,12 +457,13 @@ class TestUtils(testtools.TestCase):
self.assertEqual(ret, logs_string) self.assertEqual(ret, logs_string)
calls = [mock.call(['dmesg']), mock.call(['ps', 'au']), calls = [mock.call(['dmesg']), mock.call(['ps', 'au']),
mock.call(['df', '-a']), mock.call(['iptables', '-L']), mock.call(['df', '-a']), mock.call(['iptables', '-L']),
mock.call(['ip', 'addr'])] mock.call(['ip', 'addr']),
mock.call(['lshw', '-quiet', '-json'])]
mock_outputs.assert_has_calls(calls, any_order=True) mock_outputs.assert_has_calls(calls, any_order=True)
mock_gzip_b64.assert_called_once_with( mock_gzip_b64.assert_called_once_with(
file_list=['/var/log'], file_list=['/var/log'],
io_dict={'iptables': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY, io_dict={'iptables': mock.ANY, 'ip_addr': mock.ANY, 'ps': mock.ANY,
'dmesg': mock.ANY, 'df': mock.ANY}) 'dmesg': mock.ANY, 'df': mock.ANY, 'lshw': mock.ANY})
def test_get_ssl_client_options(self): def test_get_ssl_client_options(self):
# defaults # defaults

View File

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

View File

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