Skip to content

Commit

Permalink
Enable the logs collection by default
Browse files Browse the repository at this point in the history
It's incredibly helpful when debugging and most of consumers seem
to enable and rely on it.

Change-Id: I33bf58b3eb16b63b70f2a23e8a04449dc88fd94c
  • Loading branch information
dtantsur committed Aug 19, 2020
1 parent ba6ca24 commit d50ff06
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ironic_python_agent/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
16 changes: 10 additions & 6 deletions ironic_python_agent/tests/unit/test_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down
5 changes: 5 additions & 0 deletions releasenotes/notes/inspector-logs-9b7c010c219691d2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
features:
- |
The ``logs`` inspection collector is now enabled by default, change
``ipa-inspection-collectors`` to disable.

0 comments on commit d50ff06

Please sign in to comment.