diff options
author | Zuul <zuul@review.opendev.org> | 2019-07-03 17:21:29 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-07-03 17:21:29 +0000 |
commit | 0bb161398ad6f5b4fe2b07876e5bcad190452b99 (patch) | |
tree | f1d39347176cfc466d7a132ed1dfb87c921ed375 | |
parent | 64548591bc87f36228414bb777825c38e5346335 (diff) | |
parent | d0d47ce08f0cebed9eeb7e8d4d61219b267c06f7 (diff) | |
download | ironic-python-agent-0bb161398ad6f5b4fe2b07876e5bcad190452b99.tar.gz |
Merge "Stop logging lshw output, collect it with other logs instead" into stable/queens
-rw-r--r-- | ironic_python_agent/hardware.py | 2 | ||||
-rw-r--r-- | ironic_python_agent/tests/unit/test_utils.py | 10 | ||||
-rw-r--r-- | ironic_python_agent/utils.py | 1 | ||||
-rw-r--r-- | releasenotes/notes/lshw-cb89894be057bdc9.yaml | 5 |
4 files changed, 13 insertions, 5 deletions
diff --git a/ironic_python_agent/hardware.py b/ironic_python_agent/hardware.py index c4a16f08..16ae5115 100644 --- a/ironic_python_agent/hardware.py +++ b/ironic_python_agent/hardware.py @@ -72,7 +72,7 @@ def _get_system_lshw_dict(): :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) diff --git a/ironic_python_agent/tests/unit/test_utils.py b/ironic_python_agent/tests/unit/test_utils.py index 8fe8ee53..32933f65 100644 --- a/ironic_python_agent/tests/unit/test_utils.py +++ b/ironic_python_agent/tests/unit/test_utils.py @@ -436,12 +436,13 @@ class TestUtils(testtools.TestCase): self.assertEqual(ret, logs_string) mock_logs.assert_called_once_with(lines=None) 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_gzip_b64.assert_called_once_with( file_list=[], 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, 'is_journalctl_present', autospec=True) @@ -456,12 +457,13 @@ class TestUtils(testtools.TestCase): self.assertEqual(ret, logs_string) calls = [mock.call(['dmesg']), mock.call(['ps', 'au']), 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_gzip_b64.assert_called_once_with( file_list=['/var/log'], 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): # defaults diff --git a/ironic_python_agent/utils.py b/ironic_python_agent/utils.py index 2bc2bfa1..de46c6ce 100644 --- a/ironic_python_agent/utils.py +++ b/ironic_python_agent/utils.py @@ -56,6 +56,7 @@ COLLECT_LOGS_COMMANDS = { 'df': ['df', '-a'], 'iptables': ['iptables', '-L'], 'ip_addr': ['ip', 'addr'], + 'lshw': ['lshw', '-quiet', '-json'], } diff --git a/releasenotes/notes/lshw-cb89894be057bdc9.yaml b/releasenotes/notes/lshw-cb89894be057bdc9.yaml new file mode 100644 index 00000000..94a97a3f --- /dev/null +++ b/releasenotes/notes/lshw-cb89894be057bdc9.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + The ``lshw`` output no longer pollutes the debug logging. Instead, it's + stored as part of the ramdisk logs. |