Merge "Enable the logs collection by default"

This commit is contained in:
Zuul 2020-08-22 19:19:22 +00:00 committed by Gerrit Code Review
commit a8b865de9e
3 changed files with 16 additions and 7 deletions

View File

@ -23,7 +23,7 @@ CONF = cfg.CONF
APARAMS = utils.get_agent_params() APARAMS = utils.get_agent_params()
INSPECTION_DEFAULT_COLLECTOR = 'default' INSPECTION_DEFAULT_COLLECTOR = 'default,logs'
INSPECTION_DEFAULT_DHCP_WAIT_TIMEOUT = 60 INSPECTION_DEFAULT_DHCP_WAIT_TIMEOUT = 60
cli_opts = [ cli_opts = [

View File

@ -49,10 +49,14 @@ class AcceptingFailure(mock.Mock):
class TestMisc(base.IronicAgentTest): class TestMisc(base.IronicAgentTest):
def test_default_collector_loadable(self): def test_default_collector_loadable(self):
ext = inspector.extension_manager( defaults = config.INSPECTION_DEFAULT_COLLECTOR.split(',')
[config.INSPECTION_DEFAULT_COLLECTOR]) # default should go first
self.assertIs(ext[config.INSPECTION_DEFAULT_COLLECTOR].plugin, self.assertEqual('default', defaults[0])
inspector.collect_default) # 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): def test_raise_on_wrong_collector(self):
self.assertRaisesRegex(errors.InspectionError, self.assertRaisesRegex(errors.InspectionError,
@ -246,7 +250,7 @@ class TestCollectDefault(BaseDiscoverTest):
self.assertEqual('boot:if', self.data['boot_interface']) self.assertEqual('boot:if', self.data['boot_interface'])
self.assertEqual(self.inventory['disks'][2].name, self.assertEqual(self.inventory['disks'][2].name,
self.data['root_disk'].name) self.data['root_disk'].name)
self.assertEqual({'collectors': ['default'], 'managers': mgrs}, self.assertEqual({'collectors': ['default', 'logs'], 'managers': mgrs},
self.data['configuration']) self.data['configuration'])
mock_dispatch.assert_called_once_with('list_hardware_info') mock_dispatch.assert_called_once_with('list_hardware_info')
@ -283,7 +287,7 @@ class TestCollectDefault(BaseDiscoverTest):
self.assertEqual('boot:if', self.data['boot_interface']) self.assertEqual('boot:if', self.data['boot_interface'])
self.assertNotIn('root_disk', self.data) self.assertNotIn('root_disk', self.data)
self.assertEqual({'collectors': ['default'], 'managers': mgrs}, self.assertEqual({'collectors': ['default', 'logs'], 'managers': mgrs},
self.data['configuration']) self.data['configuration'])
mock_dispatch.assert_called_once_with('list_hardware_info') mock_dispatch.assert_called_once_with('list_hardware_info')

View File

@ -0,0 +1,5 @@
---
features:
- |
The ``logs`` inspection collector is now enabled by default, change
``ipa-inspection-collectors`` to disable.