Allow md5 to be disabled from the conductor

Also fixes my use of set_override, as it is not on the actual
config object. You'd think I'd remember that, since I've done
that before...

Change-Id: I4b578c4319354001cbbd3b3856af96b30fd25555
This commit is contained in:
Julia Kreger 2023-05-04 18:01:57 -07:00
parent c05fdf790c
commit e6fd7e753e
2 changed files with 10 additions and 5 deletions

View File

@ -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')

View File

@ -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(