diff --git a/ironic_python_agent/agent.py b/ironic_python_agent/agent.py index 3fad86f32..a290c827f 100644 --- a/ironic_python_agent/agent.py +++ b/ironic_python_agent/agent.py @@ -408,8 +408,9 @@ class IronicPythonAgent(base.ExecuteCommandMixin): if config.get('metrics_statsd'): for opt, val in config.items(): setattr(cfg.CONF.metrics_statsd, opt, val) - if config.get('agent_md5_checksum_enable'): - cfg.set_override('md5_enabled', True) + md5_allowed = config.get('agent_md5_checksum_enable') + if md5_allowed is not None: + cfg.CONF.set_override('md5_enabled', md5_allowed) if config.get('agent_token_required'): self.agent_token_required = True token = config.get('agent_token') diff --git a/ironic_python_agent/tests/unit/test_agent.py b/ironic_python_agent/tests/unit/test_agent.py index b5e40bf6c..3f284a896 100644 --- a/ironic_python_agent/tests/unit/test_agent.py +++ b/ironic_python_agent/tests/unit/test_agent.py @@ -230,7 +230,8 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest): 'uuid': 'deadbeef-dabb-ad00-b105-f00d00bab10c' }, 'config': { - 'heartbeat_timeout': 300 + 'heartbeat_timeout': 300, + 'agent_md5_checksum_enable': False } } @@ -246,6 +247,7 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest): mock.call('wait_for_disks')], mock_dispatch.call_args_list) self.agent.heartbeater.start.assert_called_once_with() + self.assertFalse(CONF.md5_enabled) @mock.patch( 'ironic_python_agent.hardware_managers.cna._detect_cna_card', @@ -259,7 +261,7 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest): mock_wait, mock_dispatch): CONF.set_override('inspection_callback_url', '') CONF.set_override('listen_tls', True) - + CONF.set_override('md5_enabled', False) wsgi_server = mock_wsgi.return_value def set_serve_api(): @@ -273,7 +275,8 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest): 'uuid': 'deadbeef-dabb-ad00-b105-f00d00bab10c' }, 'config': { - 'heartbeat_timeout': 300 + 'heartbeat_timeout': 300, + 'agent_md5_checksum_enable': True } } @@ -289,6 +292,7 @@ class TestBaseAgent(ironic_agent_base.IronicAgentTest): mock.call('wait_for_disks')], mock_dispatch.call_args_list) self.agent.heartbeater.start.assert_called_once_with() + self.assertTrue(CONF.md5_enabled) @mock.patch('ironic_lib.mdns.get_endpoint', autospec=True) @mock.patch(