From d50ff06b6bbf8909496882c7200c11299dc6b039 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Wed, 19 Aug 2020 17:23:47 +0200 Subject: [PATCH] Enable the logs collection by default It's incredibly helpful when debugging and most of consumers seem to enable and rely on it. Change-Id: I33bf58b3eb16b63b70f2a23e8a04449dc88fd94c --- ironic_python_agent/config.py | 2 +- ironic_python_agent/tests/unit/test_inspector.py | 16 ++++++++++------ .../notes/inspector-logs-9b7c010c219691d2.yaml | 5 +++++ 3 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/inspector-logs-9b7c010c219691d2.yaml diff --git a/ironic_python_agent/config.py b/ironic_python_agent/config.py index 9079d1545..2c8105b11 100644 --- a/ironic_python_agent/config.py +++ b/ironic_python_agent/config.py @@ -23,7 +23,7 @@ APARAMS = utils.get_agent_params() -INSPECTION_DEFAULT_COLLECTOR = 'default' +INSPECTION_DEFAULT_COLLECTOR = 'default,logs' INSPECTION_DEFAULT_DHCP_WAIT_TIMEOUT = 60 cli_opts = [ diff --git a/ironic_python_agent/tests/unit/test_inspector.py b/ironic_python_agent/tests/unit/test_inspector.py index c1fe2fc2a..900a048a0 100644 --- a/ironic_python_agent/tests/unit/test_inspector.py +++ b/ironic_python_agent/tests/unit/test_inspector.py @@ -49,10 +49,14 @@ def assert_called_with_failure(self, expect_error=False): class TestMisc(base.IronicAgentTest): def test_default_collector_loadable(self): - ext = inspector.extension_manager( - [config.INSPECTION_DEFAULT_COLLECTOR]) - self.assertIs(ext[config.INSPECTION_DEFAULT_COLLECTOR].plugin, - inspector.collect_default) + defaults = config.INSPECTION_DEFAULT_COLLECTOR.split(',') + # default should go first + self.assertEqual('default', defaults[0]) + # logs much go last + self.assertEqual('logs', defaults[-1]) + ext = inspector.extension_manager(defaults) + for collector in defaults: + self.assertTrue(callable(ext[collector].plugin)) def test_raise_on_wrong_collector(self): self.assertRaisesRegex(errors.InspectionError, @@ -246,7 +250,7 @@ def test_ok(self, mock_dispatch, mock_wait_for_dhcp, mock_get_mgrs): self.assertEqual('boot:if', self.data['boot_interface']) self.assertEqual(self.inventory['disks'][2].name, self.data['root_disk'].name) - self.assertEqual({'collectors': ['default'], 'managers': mgrs}, + self.assertEqual({'collectors': ['default', 'logs'], 'managers': mgrs}, self.data['configuration']) mock_dispatch.assert_called_once_with('list_hardware_info') @@ -283,7 +287,7 @@ def test_no_root_disk(self, mock_dispatch, mock_wait_for_dhcp, self.assertEqual('boot:if', self.data['boot_interface']) self.assertNotIn('root_disk', self.data) - self.assertEqual({'collectors': ['default'], 'managers': mgrs}, + self.assertEqual({'collectors': ['default', 'logs'], 'managers': mgrs}, self.data['configuration']) mock_dispatch.assert_called_once_with('list_hardware_info') diff --git a/releasenotes/notes/inspector-logs-9b7c010c219691d2.yaml b/releasenotes/notes/inspector-logs-9b7c010c219691d2.yaml new file mode 100644 index 000000000..49ac74ce4 --- /dev/null +++ b/releasenotes/notes/inspector-logs-9b7c010c219691d2.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The ``logs`` inspection collector is now enabled by default, change + ``ipa-inspection-collectors`` to disable.